Repeatably apply externally generated spline coordinates
Prerequisites
- 3MF with absolute position stored in it
- External source of spline coordinates
- Netfabb
or Ultimate to run Lua scripting
Jump to:
Define Modify actions
Create a new support script manually. A support script is a plaintext, human-readable file with a very simple XML-like structure and a SUPPORT filename suffix.
<root> </root>
For every individual support entity to be deflected along a spline, define a new Modify script action.
<supportaction enabled="1" id="12" supportaction_id="0"> </supportaction>
- enabled="1" marks the action as executable, otherwise it's skipped. Optional.
- id="12" selects the Modify action
- supportaction_id="0" is a running number for all actions in a script, starting with 0. Not used in Netfabb, optional.
Support detection parameters
For every <supportaction id="12"> element Netfabb normally creates, these <supportoption> elements are included by default. They may be left out if not used.
<supportoption id="action_description" value="" visible="1"/> <supportoption id="modify_above_z" value="0" visible="1"/> <supportoption id="modify_below_z" value="100000" visible="1"/> <supportoption id="modify_z_range" value="0" visible="1"/> <supportoption id="modify_min_height" value="0" visible="1"/> <supportoption id="modify_max_height" value="100000" visible="1"/> <supportoption id="modify_connections" value="0" visible="1"/>
As for the <supportoption> elements that actually adjust anything in this application, generate these elements to select and modify the entities in question:
<supportoption id="modify_type" value="0" visible="1"/> <supportoption id="modify_use_position" value="1" visible="1"/> <supportoption id="modify_position" value="0.00|0.00|0.00" visible="1"/> <supportoption id="modify_values" value="volume_projection=2;volume_spline_value=2| 0.0|0.0|0.0| 0.0|0.0|0.0| 0.0|0.0|0.0| 0.0|0.0|0.0|" visible="0"/>
- modify_type selects from bar, polyline, and volume supports with 0, 1, or 2, respectively. The Modify action only works on one type at a time. Also, only volume support may be deflected with a spline, so, setting value to anything other than 2 in this application does not make sense.
- modify_use_position set to value="1" switches to a positional selection of entities.
- modify_position specifies the position of a search location using value="0.00|0.00|0.00" that then serves to select the actual support entity to modify. The distances are X, Y, Z in absolute values from front-left-bottom corner of the buildroom and given in millimeters. This point may be anywhere within the bounding box of the support entity to modify. Overlapping bounding boxes should be avoided as the result may currently be unpredictable.
- modify_values contains the actual parameters to override, and with what new values.
value contains the individual parameter-and-value sets separated by semicolon:
- volume_projection=2 sets the deflection method to Along a spline.
- volume_spline_value=2| 0.0|0.0|0.0| 0.0|0.0|0.0| 0.0|0.0|0.0| 0.0|0.0|0.0| selects the Bézier type (2 = quadratic), and the following triplets represent X, Y, and Z coordinates for the positions of the spline control points. (The space characters are optional, they are here for readability only.)
- visible="0" hides the parameter in Netfabb's support editor. For this application, it is always optional as the script is only used by Lua directly where the support editor GUI is not involved.
Conditions the control point coordinates must satisfy
- Order of control points is bottom to top.
- At least four control points are required.
- The first point (bottom) must have a Z value of 0.
- The second point (second from bottom) must have the same X and Y values as the first (bottom) point.
- The last point (top) must be in the center of the connecting area of the volume support.
- The second to last point (second from top) must have equal X and Y values as the top point.
The Lua script
The example script uses D:\temp\ for all involved files. Make sure to adjust every instance to match your situation.
-- Generate volume support on spline for specific part geometry and apply support modification -- Load the mesh local mesh = system:load3mf('D:/temp/technical_part_2_positioned.3mf'); -- Generate support local support = mesh:createsupport('D:/temp/VolumeSupportOnSpline.support'); -- Create the part local part = tray.root:addmesh(mesh, 'VolumeSupportOnSpline'); part:assignsupport(support, false); -- Export local exporter = system:create3mfexporter(); exporter:add(part); exporter:exporttofile("D:/temp/Output.3mf");Top
Example files
Part, support script, and Lua code are available for download here: https://knowledge.autodesk.com/support/netfabb/downloads/caas/downloads/content/example-files-for-spline-deflection-volume-support-through-lua.html
In addition to the modify actions described above, the support script in the example also contains the action that generates the support itself.
Top