Description Sets the boolean operation specification string for an element composite.
Syntax ElemBooleanSetSpec elemCompNode, specString
Parameters elemCompNode As Long Node number of the element composite whose boolean operation string is being set.
specString As String Boolean operation string being applied to the element composite. String names for the component elements must be full hierarchical names and must include outside parenthesis (i.e. "Geometry.ElemComposite.Sphere 1" and not simply "Sphere 1" ). Boolean operations are specified in symbol or string form and parenthesis can also be used:
Example The following example creates a new element composite, two component element primitive spheres and assigns a boolean operation specification string to form the solid. The Chr(34) entry in the specification string inserts the required quotations around the component entities' hierarchical name. The code block for deleting any existing geometry allows this script to be run on an empty FRED document for testing, without needing to manually delete the newly created solid each iteration. If this behavior is not desired, this block of code should be removed.
Dim ent As T_ENTITY Dim op As T_OPERATION Dim ii As Long, elemCompNode As Long, elemPrimNode1 As Long, elemPrimNode2 As Long Dim success As Boolean Dim specString As String
'delete any existing geometries For ii = GetEntityCount()-1 To 4 Step -1 success = DeleteEntity( ii ) Next ii
'create an element composite node InitEntity ent ent.name = "Unioned Spheres" ent.parent = 2 elemCompNode = ElemAddBoolean( ent )
'initialize the t_operation information op.parent = elemCompNode op.Type = "ShiftX"
'create the element primitives as children of the composite InitEntity ent ent.name = "Sphere 1" ent.parent = elemCompNode 'add first sphere elemPrimNode1 = ElemAddSphere( ent ) ElemSetParmValue elemPrimNode1, 0, 2 op.val1 = -1 AddOperation elemPrimNode1, op 'add second sphere InitEntity ent ent.name = "Sphere 2" ent.parent = elemCompNode elemPrimNode2 = ElemAddSphere( ent ) ElemSetParmValue elemPrimNode2, 0, 2 op.val1 = 1 AddOperation elemPrimNode2, op
'add the boolean operation string to the element composite to combine the primitives into a solid specString = Chr(34) & GetFullName( elemPrimNode1 ) & Chr(34) & " & " & Chr(34) & GetFullName( elemPrimNode2 ) & Chr(34) ElemBooleanSetSpec elemCompNode, specString
'get the specification string from an element composite node ElemBooleanGetSpec elemCompNode, specString Print "The spec string is: " & specString
'update the document Update
See Also Element Primitive Script Commands Element Composite (boolean) Script Commands
|