AutoCAD Architecture Customization
Welcome to Autodesk’s AutoCAD Architecture Customization Forums. Share your knowledge, ask questions, and explore popular AutoCAD Architecture Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Union 3DSolids

1 REPLY 1
Reply
Message 1 of 2
Anonymous
250 Views, 1 Reply

Union 3DSolids

Is there a way to Union 3dSolids using VBA? If so, can someone please
provide the coding?

Thanks,
Chris Cox
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

As taken right out from the help files in Autocad

Sub Example_Boolean()
' This example creates a box and a cylinder in model space.
' It then performs a boolean operation on the two solids.

Dim boxObj As Acad3DSolid
Dim boxLength As Double, boxWidth As Double, boxHeight As Double
Dim boxCenter(0 To 2) As Double
boxCenter(0) = 5#: boxCenter(1) = 5#: boxCenter(2) = 0
boxLength = 10#: boxWidth = 7: boxHeight = 10#

' Create the box (3DSolid) object in model space
Set boxObj = ThisDrawing.ModelSpace.AddBox(boxCenter, boxLength,
boxWidth, boxHeight)
boxObj.Color = acWhite

' Define the cylinder
Dim cylinderObj As Acad3DSolid
Dim cylinderCenter(0 To 2) As Double
Dim cylinderRadius As Double
Dim cylinderHeight As Double
cylinderCenter(0) = 0#: cylinderCenter(1) = 0#: cylinderCenter(2) = 0#
cylinderRadius = 5#
cylinderHeight = 20#

' Create the Cylinder (3DSolid) object in model space
Set cylinderObj = ThisDrawing.ModelSpace.AddCylinder(cylinderCenter,
cylinderRadius, cylinderHeight)
cylinderObj.Color = acWhite

' Change the viewing direction of the viewport
Dim NewDirection(0 To 2) As Double
NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
ThisDrawing.ActiveViewport.direction = NewDirection
ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
ZoomAll

' Perform an intersection on the two solids
MsgBox "Perform an intersection on the two solids.", vbOKOnly, "Boolean
Example"
boxObj.Boolean acIntersection, cylinderObj
ThisDrawing.Regen True

MsgBox "Intersection complete.", , "Boolean Example"

End Sub


--
-------------------------------------------------------------------------
Rob Starz
Plogv 3.0 & 2000 (plot logging) for r14 & 2000
***Enhancement Tools for Arch. Desktop *****
!!!!!Beta Testers Needed For DormerX!!!!!!!
http://www.stardsign.com/DormerXForm.htm
http://www.stardsign.com/main.htm

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report