+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 16
  1. #1
    Forum Newbie
    Using
    AutoCAD 2008
    Join Date
    Mar 2012
    Posts
    9

    Default Trimmed Polyline Length Error

    Registered forum members do not see this ad.

    Hi, I'm Acad 2010 user. The attached file, the problem seems. I'm having trouble polyline you change the location of objects. When I move to area 1. Polyline inside area 1 the trimmed length is correct. But When I move to area 2 Polyline inside area 2 the trimmed length is incorrect. Remains a small piece of magenta polyline.

    Is UCS values ​​is bigger is going on?

    However, when you have made a query. Acad finds 2 intersection point in area 2, incorrect. And Acad finds 1 intersection point in area 1,correct.

    I do not understand the problem. Thanks for your help.

    (All Z values ​​to zero. All objects is polyline)
    Attached Files

  2. #2
    Forum Deity
    Using
    AutoCAD 2002
    Join Date
    Sep 2006
    Location
    East Sussex, U.K.
    Posts
    4,058

    Default

    Your problem has nothing to do with the area of the drawing that you are in, but with the method of using the Trim command.

    If you trim by choosing a cutting edge, you get the result in area 1.

    If you trim by letting AutoCAD choose the cutting edge, you get the result in area 2. Your polyline is not curve fitted and consists of a series of straight lines. What has happened is that AutoCAD chose the segment of the polyline to the right of the true intersection and used an imaginary extension of that line (the black dashed line in the picture) for the Trim. Hence your difference.
    Attached Images

  3. #3
    Forum Newbie
    Using
    AutoCAD 2008
    Join Date
    Mar 2012
    Posts
    9

    Default

    I'm sorry I do not understand the full solution. My english is a little poor. There are a lot drawing of polylines. I do it all. What should I do. Required lengths of polylines to me. Where should I set? Can you tell me step by step. I'm sorry. Thank you.

  4. #4
    Forum Deity
    Using
    AutoCAD 2002
    Join Date
    Sep 2006
    Location
    East Sussex, U.K.
    Posts
    4,058

    Default

    When you use the Trim command, keep looking at the command line, which tells you what to do.

    First of all, it tells you to "Select cutting edges"and then "Select objects". If you press return at this point, then you are letting AutoCAD choose the cutting edges.
    So you must pick your cutting edge, in this case the yellow polyline. When you have finished selecting the cutting edges, you press Return to let AutoCAD know that you have finished selecting the cutting edges.
    Then the command line says "select object to trim......" and then you pick your magenta line.

    If you still do not understand, then you should look at your help files, which should be in your own language.

  5. #5
    Forum Newbie
    Using
    AutoCAD 2008
    Join Date
    Mar 2012
    Posts
    9

    Default

    Hi eldon thanks for help.

    But there's a problem. I got to the intersection point. Point with VBA to read. Very points. But it shows an incorrect result. I'm not sure this is the place to VBA forum? VBA does not work why? Do you have one you know? Thanks in advance. The same two points. But the result is different from 2. Very stuck. I need to find.

    /////////
    Code:
    Sub IPNT()
    Dim objSS As AcadSelectionSet
    Dim objSS2 As AcadSelectionSet
    Dim Poly1 As AcadLWPolyline
    Dim Poly2 As AcadLWPolyline
    On Error Resume Next
    ThisDrawing.SelectionSets("TempSSet1").Delete
    On Error Resume Next
    Set objSS = ThisDrawing.SelectionSets.Add("TempSSet1")
    If Err Then Exit Sub
    MsgBox "Select Poly 1"
    objSS.SelectOnScreen
    For Each Poly1 In objSS
    Exit For: Next
    On Error Resume Next
    ThisDrawing.SelectionSets("TempSSet2").Delete
    On Error Resume Next
    Set objSS2 = ThisDrawing.SelectionSets.Add("TempSSet2")
    If Err Then Exit Sub
    MsgBox "Select Poly 2"
    objSS2.SelectOnScreen
    For Each Poly2 In objSS2
    Exit For: Next
    pts = Poly1.IntersectWith(Poly2, acExtendNone)
    MsgBox "X= " & pts(0) & vbCr & "Y= " & pts(1), vbInformation, "Intersection Point"
    End Sub
    /////////

    Give different results in the same code area 1. Area 2 also give different results.

    Thanks for help.
    Attached Images
    Attached Files
    Last edited by SLW210; 30th Jan 2013 at 02:54 pm. Reason: Code Tags!!

  6. #6
    Forum Newbie
    Using
    AutoCAD 2008
    Join Date
    Mar 2012
    Posts
    9

    Default IntersectWith not working correctly VBA

    I got to the point of intersection of two polylines. The process will be repeated many times. However, according to the VBA codes trying different UCS coordinates. Codes in area 1 is working correctly. Working in the wrong area 2.

    Similarly, there is also the problem trim. You can see the link below.

    http://www.cadtutor.net/forum/showth...e-Length-Error


    /////////
    Code:
    Sub IPNT()
    Dim objSS As AcadSelectionSet
    Dim objSS2 As AcadSelectionSet
    Dim Poly1 As AcadLWPolyline
    Dim Poly2 As AcadLWPolyline
    On Error Resume Next
    ThisDrawing.SelectionSets("TempSSet1").Delete
    On Error Resume Next
    Set objSS = ThisDrawing.SelectionSets.Add("TempSSet1")
    If Err Then Exit Sub
    MsgBox "Select Poly 1"
    objSS.SelectOnScreen
    For Each Poly1 In objSS
    Exit For: Next
    On Error Resume Next
    ThisDrawing.SelectionSets("TempSSet2").Delete
    On Error Resume Next
    Set objSS2 = ThisDrawing.SelectionSets.Add("TempSSet2")
    If Err Then Exit Sub
    MsgBox "Select Poly 2"
    objSS2.SelectOnScreen
    For Each Poly2 In objSS2
    Exit For: Next
    pts = Poly1.IntersectWith(Poly2, acExtendNone)
    MsgBox "X= " & pts(0) & vbCr & "Y= " & pts(1), vbInformation, "Intersection Point"
    End Sub
    /////////


    Thanks for help.
    Attached Images
    Attached Files
    Last edited by SLW210; 30th Jan 2013 at 02:52 pm. Reason: Code Tags!!

  7. #7
    Super Member Tyke's Avatar
    Computer Details
    Tyke's Computer Details
    Operating System:
    Windows 7 - 64 bit, W8 + W8.1 Vista
    Computer:
    HP Z400 Workstation
    CPU:
    Intel(R) Xeon(R) CPU W3530 @ 2.80GHz
    RAM:
    8 GB
    Graphics:
    Nvidia Quadro 600 1GB DDR3
    Primary Storage:
    2x 500GB HDD RAID 1 and Western Digital 2TB NAS RAID 1
    Secondary Storage:
    Lacie external HDD 2TB Raid Level 1
    Monitor:
    Samsung SyncMaster P2770HD, 2443 and 193T
    Discipline
    Multi-disciplinary
    Tyke's Discipline Details
    Occupation
    Surveyor, programmer, civil engineer
    Discipline
    Multi-disciplinary
    Details
    Surveying and civil engineering. As built utilities surveys and data maintenance in GIS systems. Building surveys, measured and laser scanning. Setting out of all civil works. Control and settlement surveys. Programming in AutoCAD, MicroStation, Geograf and stand alone applications for all uses.
    Using
    Civil 3D 2014
    Join Date
    Jun 2006
    Location
    Saxony, Germany
    Posts
    1,397

    Default

    I can't see the point of the selection sets for holding a single entity, you already have two variables for your polylines and then using them with GETENTITY you can omit your selection sets with the respective code, the two loops, which are doing nothing anyway, and your first message box. You have not declared the variable 'pts' either.

    Try this ammended code:

    Code:
    Sub IPNT()
    
        Dim Poly1   As AcadLWPolyline
        Dim Poly2   As AcadLWPolyline
        Dim pts     As Variant
        Dim varPick As Variant
        Dim objEnt  As AcadEntity
        
        ThisDrawing.Utility.GetEntity objEnt, varPick, "Select Poly 1: "
        If objEnt.ObjectNAme = "AcDbPolyline" then
            Set Poly1 = objEnt
        End If
        
        ThisDrawing.Utility.GetEntity objEnt, varPick, "Select Poly 1: "
        If objEnt.ObjectNAme = "AcDbPolyline" then
            Set Poly1 = objEnt
        End If
        
        pts = Poly1.IntersectWith(Poly2, acExtendNone)
        
        MsgBox "X= " & pts(0) & vbCr & "Y= " & pts(1), vbInformation, "Intersection Point"
        
    End Sub
    Engage brain before mouth

    "The German who types with a Yorkshire accent" - Dave Broada 2o1o

  8. #8
    Forum Newbie
    Using
    AutoCAD 2008
    Join Date
    Mar 2012
    Posts
    9

    Default

    The problem is not that you type Tyke. Of intersection is not working correctly. Thank you for your interest.

  9. #9
    Super Member Tyke's Avatar
    Computer Details
    Tyke's Computer Details
    Operating System:
    Windows 7 - 64 bit, W8 + W8.1 Vista
    Computer:
    HP Z400 Workstation
    CPU:
    Intel(R) Xeon(R) CPU W3530 @ 2.80GHz
    RAM:
    8 GB
    Graphics:
    Nvidia Quadro 600 1GB DDR3
    Primary Storage:
    2x 500GB HDD RAID 1 and Western Digital 2TB NAS RAID 1
    Secondary Storage:
    Lacie external HDD 2TB Raid Level 1
    Monitor:
    Samsung SyncMaster P2770HD, 2443 and 193T
    Discipline
    Multi-disciplinary
    Tyke's Discipline Details
    Occupation
    Surveyor, programmer, civil engineer
    Discipline
    Multi-disciplinary
    Details
    Surveying and civil engineering. As built utilities surveys and data maintenance in GIS systems. Building surveys, measured and laser scanning. Setting out of all civil works. Control and settlement surveys. Programming in AutoCAD, MicroStation, Geograf and stand alone applications for all uses.
    Using
    Civil 3D 2014
    Join Date
    Jun 2006
    Location
    Saxony, Germany
    Posts
    1,397

    Default

    Can you please be more specific when describing your problem, I do not understand what it is. What exactly do you mean by
    Of intersection is not working correctly.
    ? What is not working correctly?

    Describe the steps you have taken and which results are wrong. Check in your drawing the physical intersection coordinates of the two polylines and do these agree with what your program is delivering?
    Engage brain before mouth

    "The German who types with a Yorkshire accent" - Dave Broada 2o1o

  10. #10
    Forum Newbie
    Using
    AutoCAD 2008
    Join Date
    Mar 2012
    Posts
    9

    Default

    Registered forum members do not see this ad.

    Hi Tyke. I told a more descriptive way. Waiting for assistance. Thanks in advance.

    Objects gives an error when I move into the area 2. Deceive me. (UCS) coordinates is making the problem be?

    Code:
    Sub DEDECTIPONPL()
        Dim Poly1   As AcadLWPolyline
        Dim Poly2   As AcadLWPolyline
        Dim pts     As Variant
        Dim varPick As Variant
        Dim objEnt  As AcadEntity
        ThisDrawing.Utility.GetEntity objEnt, varPick, "Select Poly 1: "
        If objEnt.ObjectName = "AcDbPolyline" Then
            Set Poly1 = objEnt
        End If
        ThisDrawing.Utility.GetEntity objEnt, varPick, "Select Poly 2: "
        If objEnt.ObjectName = "AcDbPolyline" Then
            Set Poly2 = objEnt
        End If
        'This Project can be dedected, 1,2 or 3 intersection point of Plines.
        'This program will detect the number of point of intersection.
        pts = Poly1.IntersectWith(Poly2, acExtendNone)
        If UBound(pts) = 2 Then
        MsgBox "1 intersection point dedected." & vbCr & _
        "X= " & pts(0) & ", " & "Y= " & pts(1) & vbCr, _
        vbInformation, "Intersection Point Dedector"
        ElseIf UBound(pts) = 5 Then
        MsgBox "2 intersection point dedected." & vbCr & _
        "X= " & pts(0) & ", " & "Y= " & pts(1) & vbCr & _
        "X= " & pts(3) & ", " & "Y= " & pts(4), _
        vbInformation, "Intersection Point Dedector"
        ElseIf UBound(pts) = 8 Then
        MsgBox "3 intersection point dedected." & vbCr & _
        "X= " & pts(0) & ", " & "Y= " & pts(1) & vbCr & _
        "X= " & pts(3) & ", " & "Y= " & pts(4) & vbCr & _
        "X= " & pts(6) & ", " & "Y= " & pts(7), _
        vbInformation, "Intersection Point Dedector"
        Else
        MsgBox "intersection point number > 3" & vbCr & "Program Limits Exceed"
        End If
    End Sub
    Attached Images
    Attached Files

Similar Threads

  1. Draw Order not working correctly
    By slimjramirez in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 15
    Last Post: 2nd Aug 2017, 12:27 am
  2. data extraction not working correctly
    By T_Shadle in forum AutoCAD Bugs, Error Messages & Quirks
    Replies: 0
    Last Post: 20th Jul 2011, 03:25 pm
  3. Why is Fillet not working correctly?
    By Jimidy in forum AutoCAD Drawing Management & Output
    Replies: 14
    Last Post: 18th Jul 2011, 02:27 pm
  4. IntersectWith not working
    By Jozi68 in forum AutoLISP, Visual LISP & DCL
    Replies: 14
    Last Post: 12th Jan 2010, 08:22 pm
  5. LINE command not working correctly
    By doanminhchau in forum AutoCAD Beginners' Area
    Replies: 7
    Last Post: 7th Apr 2009, 07:20 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts