I am trying AddExtrudedSolid method and hope to draw a 10*10*10 cube
but when the programe goes on the AddExtrudedSolid method line
It crashed
here is my code
Code: Select all
Sub try_AddExtrudedSolid()
'Declare
'Long
Dim i As Long
'Line
Dim ActLine As IntelliCAD.Line
'Collection
Dim EdgeClctn As New Collection
'Entity
Dim Edges() As IntelliCAD.Entity
'Solid3D
Dim solidObj As IntelliCAD.Solid3D
'Variant
Dim regionObj As Variant
'Code Zone
'set Edges
EdgeClctn.Add Library.CreatePoint(0, 0, 0)
EdgeClctn.Add Library.CreatePoint(0, 10, 0)
EdgeClctn.Add Library.CreatePoint(10, 10, 0)
EdgeClctn.Add Library.CreatePoint(10, 0, 0)
'Draw Curves
ReDim Edges(0 To EdgeClctn.Count - 1)
For i = 1 To EdgeClctn.Count - 1
Set ActLine = ActiveDocument.ModelSpace.AddLine(EdgeClctn(i), EdgeClctn(i + 1))
Set Edges(i - 1) = ActLine
Next i
Set ActLine = ActiveDocument.ModelSpace.AddLine(EdgeClctn(i), EdgeClctn(1))
Set Edges(i - 1) = ActLine
'Draw Region
regionObj = ActiveDocument.ModelSpace.AddRegion(Edges)
' Create the solid
Set solidObj = ActiveDocument.ModelSpace.AddExtrudedSolid(regionObj(0), 10, 0) ''' Here is the crash point!
regionObj(0).Delete
End Sub
Can someone help me to find out the mistake or provid me some sample about the AddExtrudedSolid method?
Any help with this is appreciated.
Thank you.