-
autocad VBA problem, union after polar array Options
i want to union a big cylinder with no. of small cylinder,since the small cylinder is create by polar array, the small cylinders after polar array are "variant" not are "acad3dsolid", so the union command is not work ...so what can i do??Thanks!
[VBA] Public Sub crownplane()
Dim bigcylinder As Acad3DSolid
Dim smallcylinder As Acad3DSolid
Dim crowncen(0 To 2) As Double
crowncen(0) = 0: crowncen(1) = 0: crowncen(2) = 0
Set bigcylinder = ThisDrawing.ModelSpace.AddCylinder(crowncen, crownradius, crownheight * 1.2)
Set smallcylinder = ThisDrawing.ModelSpace.AddCylinder(crowncen, teethradius, crownheight)
Dim noofcylinder As Integer
Dim angletofill As Double
Dim polarSmallcylinder As Variant
noofcylinder = 4
angletofill = 6.28
polarSmallcylinder = smallcylinder.ArrayPolar(noofcylinder, angletofill, crowncen)
bigcylinder.Boolean acUnion, polarSmallcylinder
End Sub
[/VBA]
Last edited by Tommy; 10-17-2005 at 06:42 AM.
Reason: Added VBA tags
-
Hi clarence_cad,
Welcome to VBAExpress!
Using your example I added:
[VBA]
crownradius = 10
crownheight = 20
teethradius = 15
[/VBA]
Not sure if this is what you are trying to do but .Boolean doesn't accept arrays. So to try and get what you want I tried this with some success :
[VBA] Public Sub crownplane()
Dim bigcylinder As Acad3DSolid
Dim smallcylinder As Acad3DSolid
Dim mSolid As Acad3DSolid
Dim crowncen(0 To 2) As Double
Dim mI As Integer
crowncen(0) = 0: crowncen(1) = 0: crowncen(2) = 0
crownradius = 10
crownheight = 20
teethradius = 15
Set bigcylinder = ThisDrawing.ModelSpace.AddCylinder(crowncen, crownradius, crownheight * 1.2)
Set smallcylinder = ThisDrawing.ModelSpace.AddCylinder(crowncen, teethradius, crownheight)
ThisDrawing.Regen acActiveViewport
Dim noofcylinder As Integer
Dim angletofill As Double
Dim polarSmallcylinder As Variant
noofcylinder = 4
angletofill = 6.28
polarSmallcylinder = smallcylinder.ArrayPolar(noofcylinder, angletofill, crowncen)
For mI = 0 To UBound(polarSmallcylinder)
Set mSolid = polarSmallcylinder(mI)
bigcylinder.Boolean acUnion, mSolid
Next
Set mSolid = Nothing
ThisDrawing.Regen acActiveViewport
End Sub
[/VBA]
HTH
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules