Karol Posted September 13, 2020 Share Posted September 13, 2020 Hi, its my first time in vba programming. I try to resolve some problem. I have solid project with sphere and lines. I want to cut all lines crosing my sphere. How can i check condition lines crossing my object (sphere). Im studied documentation and i found .IntersectWith method. Can i use this? I prepared some code but i have error "object required". Someone can help me ?. Thanks for advice Sub test() Dim selectionSetLine As AcadSelectionSet Dim sphere As Acad3DSolid Dim acadEntity As acadEntity Dim intPoints As Variant Dim selectPnt As Variant ThisDrawing.Utility.GetEntity acadEntity, selectPnt, "Select sphere" Set selectionSetLine = ThisDrawing.SelectionSets.Add("line") selectionSetLine.SelectOnScreen Call checkInterference(acadEntity, selectionSetLine) End Sub Public Sub checkInterference(model As acadEntity, lines As AcadSelectionSet) Dim intPoints As Variant Dim acadLine As acadLine Dim sphere As Acad3DSolid Dim object As Object Set sphere = model MsgBox "procedure check" For Each object In lines If obj.ObjectName = "AcDbLine" Then Set acadLine = object MsgBox "test" intPoints = acadLine.IntersectWith(sphere, acExtendBoth) MsgBox "test" 'toDo condition remove line like this' 'If VarType(intPoints) <> vbEmpty Then' 'MsgBox "test"' 'acadLine.Delete' 'End If' Else: MsgBox "There are no line object" End If Next End Sub Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 14, 2020 Share Posted September 14, 2020 Have a look at this scroll down a fair bit and you may find your answer. http://paulbourke.net/geometry/circlesphere/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.