- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello world
Im trying to find the intersection of lines and blocks, but I need the accurate position. I found out the the intersectwith method returns the line and bounding box intersection point. my block is a circle and I need the exact position. by the way, its not just one circle, its a couple of circles with the same center but different radiuses.
here is the code:
Dim oblk As AcadBlock
Dim oBlk1 As AcadBlock
Dim oBlkRef As AcadBlockReference
Dim oBlkRef1 As AcadBlockReference
Dim oEnt As AcadEntity
Dim oEnt1 As AcadEntity
Dim SS As AcadSelectionSet
'*******
Dim BlockEnt As AcadEntity
For Each lineobj In LineSSet
For Each blockrefobj In BlockSSet
Set SS = BlockSSet
For Each oBlkRef In SS
Set oblk = ThisDrawing.Blocks(oBlkRef.Name)
For Each oEnt In oblk
If TypeOf oEnt Is AcadBlockReference Then
Set oBlkRef1 = oEnt
Set oBlk1 = ThisDrawing.Blocks(oBlkRef1.Name)
For Each oEnt1 In oBlk1
With oEnt1
If Not ThisDrawing.Layers(.Layer).Lock Then
.Layer = "0"
.color = acByLayer
End If
End With
Next oEnt1
Else
intpoints = lineobj.IntersectWith(oEnt, acExtendNone) '////here is the problem
MsgBox intpoints(0) & " " & intpoints(1)
End If
Next oEnt
Next oBlkRef
there is an intersection, but I get the subscript out of range error for the message box.
where is the problem?
Solved! Go to Solution.