Description Adds an Element Composite to the document using the T_ENTITY structure.
Syntax elemCompNode = ElemAddBoolean( ent )
Parameters elemCompNode ( Long ) Node number of the created element composite.
ent As T_ENTITY Structure containing the generic information regarding the element composite (name, description, parent... etc).
Example The following example creates a new element composite and two component element primitive spheres, and assigns a boolean operation specification string to form the solid. Additionally, the specification string is retrieved and printed to the output window. 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
|