ImportFreeForm Example

AEC Auto

ImportFreeForm Example

Sub Example_ImportFreeForm()

   ' This example imports a previously exported boundary representation
   ' of a mass element and applies it to a free-form mass element.
   ' It prompts users to specify the location of the new mass element.
   ' You can run this code in conjunction with Example_ExportFreeForm
   ' (run Example_ExportFreeForm first).

   Dim massElement As AecMassElement
   Dim pt As Variant
   Dim center_at_origin As Boolean

   ' Create a new mass element
   Set massElement = ThisDrawing.ModelSpace.AddCustomObject("AecMassElement")
   
   ' Set the mass element type to "free-form"
   massElement.Type = aecMassElementTypeFreeForm
   
   'Select a location for the mass element
   pt = ThisDrawing.Utility.GetPoint(, "Select the insertion point:")
   If Err.Number  0 Then
       MsgBox ("error when getting a point." & vbCrLf)
       Exit Sub
   End If
   
   massElement.Location = pt
   
   ' Use mass element Location as insertion point.
   center_at_origin = True
   
   ' Import the boundary representation.
   massElement.ImportFreeForm "c:\temp\freeform-massElement"
     
End Sub