Description
The
Parts Library command is designed to perform operations on items in the local library.
The local library concerns elements: CableBox, CableConnector, ElectricalDevice. The Parts Library command allows for the creation of custom definitions for them. The local library is always stored on the user's computer and is independent of the document being edited. This means that the elements contained in a document sent to another computer are not automatically transferred to the local library at the new location. They exist only in the sent document.
The Parts Library command enables the creation of new items in the local library or deletion of existing items from local library depending on the context in which the command is invoked (see the Usage and Options sections). Editing an item from a library is done by inserting the item into the current document, modifying it within that document, and then re-inserting it into the library under the same name.
The local library is automatically created in the $FREECAD_USER_DIR/Cables/ folder. The exact location of the $FREECAD_USER_DIR can be checked in the Python Console by invoking the command: FreeCAD.getUserAppDataDir().
Usage
Creating a new item in the local library
Prerequisite: all the necessary components required to create an element in the library already exist within the current document and they are already correctly positioned relative to one another and to the main coordinate system. Refer to Typical workflow or Tutorials for more details.
- Select the solid object, or compound of solids. This could be, for example, a previously created object of type: Std Part, PartDesign Body, Part Compound etc., an object imported from STEP file or existing object from Cables Workbench. It will be the main shape of the new item in the library.
- If needed, select all necessary CableTerminal objects holding the CTRL key. The order of selection is important. The CableTerminal objects will be numbered according to the order in which they are selected.
- If needed, select all necessary SnapLines objects holding the CTRL key. The order of selection is important. The SnapLines objects will be numbered according to the order in which they are selected.
- Run Parts Library command by one of these methods:
- The creation dialog box opens. See Options for more information. Select needed options and finally press the Add to local library button. If the element with Preset Full Name already exists in the library it will be overwritten upon further confirmation via the Force overwrite button.
Removing items from the local library
- Clear the selection of any objects (e.g. by clicking empty space in the 3D View).
- Run the Parts Library command as desribed in the step 4 above.
- The deletion dialog box opens. Select all items intended for removal and press the Delete button.
Options
- Element group: Some of the following values may be available: ,
Cable Box, Cable Connector, Electrical Device depending on the object that was selected before invoking the command.
- Class: This is a conventional name that helps in classifying items within a library. This can be company name or widely used common name for group of connectors/devices, e.g. Molex, D-Sub, MCB
- Name: This is a proper name identifying this item, e.g. a name provided by the manufacturer.
- Preset Full Name: (read only) The unique name identifying an element within a library, constructed according to the following rule: Class_Name, where Class and Name are desribed above.
- Library STEP file: This is a method for creating a STEP file in a library. Possible values are:
Copy from source STEP file, Create from selected solid object. It is recommended to use Copy from source STEP file whenever it is available, unless there is a need to regenerate the STEP file in accordance with the FreeCAD export rules.
- Source STEP file: The full path name to the chosen STEP file if
Copy from source STEP file is selected above. It may be suggested automatically if it has been found in the local library.
- Ignore placement: It forces the Placement property of the selected solid object to be ignored. It may be useful when we plan to recreate library elements from a received document. In such a case, they do not need to be manually positioned in their base location.
- Show details: It shows the detailed list of items to create or modify as well as list of library files that will be created or modified.
Notes
- It is not possible to add or remove items from the built-in library. It is provided as-is, along with the entire Cables Workbench.
- It is possible to manually modify library files. The example tutorial about creating custom connector written for previous versions of Cables Workbench is still valid.
Tutorials
todo
Typical workflow
Scenario 1: Making a new connector or device library part from a STEP file
- Obtain the STEP file
- Make your own shape of a connector/device and export it to the STEP file (example: D-Sub_DE-9_M)
- or download a ready-made STEP file from the internet. Recommended format: AP242. VERY IMPORTANT: Some STEP files may subsequently fail to load correctly from the library when creating new objects. Some STEP files might not load correctly from the library later on when creating new objects. The CableConnector STEP File describes how to deal with this problem.
- Create a new document
- Import the STEP file (command from menu: File/Import).
- Position the imported shape at the center of the coordinate system, in the orientation in which it is intended to be retrieved from the library later.
- Create a new "Connector_Dummy" and move it to the side so that it doesn't conflict with the imported shape (command CableConnector). This is needed to get CableTerminal and SnapLines objects which can't be created directly.
- Delete the "CableConnector" object and answer "Yes" to the pop-up notification. There should remain three CabeTerminal objects and one SnapLines object. They will be used to build a new library part.
- Move and rotate all needed Terminal objects into their target positions.
- If there is an insufficient number of Terminal objects, they can be duplicated by copying and pasting.
- Redundant Terminal objects can be deleted.
- it is important that the #1 vertices of the Terminal objects are oriented outwards. This is needed when connecting the cables later on.
- If necessary, the length of any Terminal object can be adjusted via its Length property.
- Set the Pin Name property for each Terminal object if needed.
- Move and rotate all needed SnapLines objects into their target positions. Follow the same rules as for the Terminal objects.
- Set the Snap Name property for each SnapLines object if needed.
- Follow the next steps according to Creating a new item in the local library.
Scenario 2: Making a new parametric cable box library part
- Create a new document
- Create a new "Customized" CableBox by selecting "Customized" preset upon creation and set all needed box parameters.
- Select created CableBox object and follow the Creating a new item in the local library without selecting any additional Terminal or SnapLines objects.
- The dialog box will automatically propose the Class and Name. They can be changed if needed.
Scenario 3: Making a new parametric terminal strip connector library part
- Create a new document
- Create a new "Customized" CableConnector by selecting "Customized" preset upon creation and set all needed connector parameters.
- Select created CableConnector object and follow the Creating a new item in the local library without selecting any additional Terminal or SnapLines objects.
- The dialog box will automatically propose the Class and Name. They can be changed if needed.