Problem using intersectWith

Problem using intersectWith

Anonymous
Not applicable
399 Views
3 Replies
Message 1 of 4

Problem using intersectWith

Anonymous
Not applicable

Hi

please refer the drawing attached. If i use intersectwith for the 2 lines in left, it works,

where as if i use the same with right side 2 lines, it does not. below is the syntax i used.

 

Sub intersectLine()

Dim ssetObj As AcadSelectionSet
On Error Resume Next
ThisDrawing.SelectionSets("TEST_SSET").Delete
On Error GoTo 0
Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_SSET")
ssetObj.SelectOnScreen

IntPoint = ssetObj.Item(0).IntersectWith(ssetObj.Item(1), acExtendBoth)
MsgBox (UBound(IntPoint))

End Sub

for left set of lines it returns 2, whereas for right set of lines it returns -1.

the 2 lines on right were copied from different files. i cross checked the properties, but could not get a clew.

 

Need help.

 

 

0 Likes
400 Views
3 Replies
Replies (3)
Message 2 of 4

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> if i use the same with right side 2 lines, it does not

Look with that statement to the right line objects:

 

(entget (car (entsel)))

And you will get that results:

 

2015-08-05 09-46-10.png

I have marked the Z-values of startpoints and endpoints of both lines, these lines do not intersect in 3D-space.

Your left objects are all at Z=0.00 and there the intersection works well.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 3 of 4

Anonymous
Not applicable

Thank you Alfred.

Believe this is some kind of accuracy error.

so i am converting all Z to zero before i proceed with my program.

Thank you again.

 

0 Likes
Message 4 of 4

Ed__Jobe
Mentor
Mentor

To convert all Z values to zero, try the Express Tools FLATTEN command.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature