QCAD - 2D CAD System.

Click here for a documentation of the DokuWiki formatting syntax that can be used in reports

Please search for existing tasks (also closed ones) before opening a new task.

Please make sure that you are using the latest Version of QCAD before posting a bug (menu Help > Check for Updates)


FS#83 - Part Library - Find Files / Generate Files

Attached to Project: QCAD
Opened by Andrew (andrew) - Thursday, 19 May 2011, 10:54 GMT+2
Last edited by Andrew (andrew) - Tuesday, 17 November 2015, 11:44 GMT+2
Task Type Task
Category QCAD (main)
Status Closed
Assigned To Andrew (andrew)
Operating System All
Severity Low
Priority Normal
Reported Version Development
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Create and extend part library.

Find Existing Files

Find files under a suitable license (e.g. creative commons) for inclusion into the QCAD part library:

  • DXF / DWG files
  • SVG files which we could convert to DXF with a command line converter or InkScape if possible.
    • DXF files produced from SVG / with InkScape contain a lot of polylines with small line segments which interpolate arcs and circles.
      • A ‘Convert Interpolating Line Segments’ tool could be used to convert line segments into arcs, ellipse arcs and circles.
        1. for c in 0...number of nodes: create arc with v[c], v[c+1], v[c+2]
        2. check if v[c+i] is also on arc for c+i<number of nodes
        3. if n nodes have been found which are all on arc and all segments have almost the same length and are relatively small compared to the whole drawing, convert them to arc
      • A ‘Simplify Polyline’ tool could be used to remove nodes that don’t add a lot of information (almost straight connected line segments).

Parameterized Items

  • Parameterized items use XDATA to let the script behind know which entities need to be changed in which way.
  • The user can choose from all supported parameters shown in a table.
  • The user can choose from options:
    • Create dimensioning
    • Create auxiliary lines
    • Create center line
    • Scaling
    • Sectional drawing
    • Hatching space
  • Disadvantage compared to automatically generated items:
    • It is not possible to add an item with it’s parameters to favorites, e.g. some specific screw often used in a drawing. To make that possible, the parameters has to be saved, too.


[mostly old] Generate Items Automatically

  • Research possibilities to turn data sheets into library parts, for example attached data sheet.
    • Ideas:
      • use an XML file for data entry, use an ECMAScript to generate symbols based on the XML file.
      • Instead of writing a complete ECMAScript file to generate the geometry, it might be possible to simply draw one item and attach XDATA to the entities for information on how the item can be scaled, stretched, etc.
        • E.g. a line might have the XDATA “transform” with value “translate(length-5, 0)” which would mean that the line has to be moved ‘length-5’ to the right, where ‘length’ is the current value of the ‘length’ parameter in the XML data file. Similarly, there could be functions like “moveEndpoint”, “moveStartpoint” or even “rotate”, “mirror”, etc.
      • XML file could contain all data and refer to a .js file that is used to generate the specific drawing. E.g.:
<!-- XML document defines a name template to use for the generated parts: -->
<parts name-template="DIN_912_M%1_L%2" script="din_912.js" format="DXF">
	<!-- Attributes to use for the name template -->
	<name-attribute attribute-name="d" />
	<name-attribute attribute-name="L" />
	<!-- For each type of the specific part, we define some parameters that 
		are identical for that type (here M3): -->
	<type d="3" D="5.5" s="2.5" k="3" b="18">
		<!-- For each of these elements, a DXF file is generated. This DXF file 
			is generated with file name "DIN_912_M3_L22.dxf" and parameters d="3" D="5.5" 
			s="2.5" k="3" b="18" L="22": -->
		<ref name="var1" />
		<ref name="var2" />
		<data L="60" />
	<type name="M4" d="7" D="3" s="4" k="3" b="20">
		<ref name="var1" />
	<var name="var1">
		<data L="22" />
		<data L="25" />
		<data L="30" />
		<data L="35" />
		<data L="40" />
		<data L="45" />
		<data L="50" />
	<var name="var2">
		<dataL L="70" />
This task depends upon

Closed by  Andrew (andrew)
Tuesday, 17 November 2015, 11:44 GMT+2
Reason for closing:  Implemented
Comment by Anonymous Submitter - Friday, 20 May 2011, 10:44 GMT+2

The following sites would need further clarifications.

  • Polantis (symbols of different manufactures)
    • "Limitation of use: 2D and 3D models, textures and any content downloaded from Polantis website may be commercially used only as a part of artwork or architectural project. Single reselling or redistributing of these models or any other content downloaded on Polantis website is prohibited."
  • cadyou (all kind of stuff)
    • "Some rights reserved" without further explanation.
      • symbol indicates license details, see http://creativecommons.org/licenses/
      • most files are marked with a 'man' symbol which is OK for us to use as long as we give credits)
      • some files are marked as "Public Domain"
  • max cad (all kind of stuff)
Comment by Andrew (andrew) - Friday, 20 May 2011, 18:06 GMT+2