ExportFreeForm Example

AEC Auto

ExportFreeForm Example

Sub Example_ExportFreeForm()

   ' This example creates a mass element, after prompting users
   ' for its insertion point, and then exports the mass element
   ' boundaries to a file.
   ' You can run this code in conjunction with Example_ImportFreeForm,
   ' which imports the saved boundaries.

    Dim massElement As AecMassElement
    Dim obj As AcadObject
    Dim center_at_origin As Boolean
    
    Dim object_selected As Boolean
    object_selected = False
     
    ' Create a new mass element with a pyramid shape.
    Set massElement = ThisDrawing.ModelSpace.AddCustomObject("AecMassElement")
    massElement.Type = aecMassElementTypePyramid
       
    'Specify 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
    massElement.Rotation = 0
    
    ' Set the pyramid's dimensions to 12' by 12' by 12'
    massElement.Width = 144
    massElement.Depth = 144
    massElement.Height = 144
    
    ' Indicate that original coordinates of the boundary
    ' representation are to be saved.
    center_at_origin = True
    
    ' Export the mass element boundaries.
    massElement.ExportFreeForm "c:\temp\freeform-massElement", center_at_origin

End Sub