Results 1 to 5 of 5

Thread: SSget a Polyline via 1 of 2 intermediate points

  1. #1
    100 Club
    Join Date
    2007-02
    Posts
    148
    Login to Give a bone
    0

    Default SSget a Polyline via 1 of 2 intermediate points

    hi pple, i want to know a way to use ssget to get a polyline entity made with 3 lines with one of the vertices, namely the 2 points that connects all 3 lines as 1 polyline, however i do not wish to explode the polyline into normal lines as i need to use the polylines for later calculations. thanks in advance.

  2. #2
    All AUGI, all the time CAB2k's Avatar
    Join Date
    2016-01
    Location
    Brandon, Florida
    Posts
    687
    Login to Give a bone
    0

    Default Re: SSget a Polyline via 1 of 2 intermediate points

    I'm confused by your request. The title says ssget pline with one known vertex.
    But then you reference TWO points and talk about LINES.
    First do you want to use ssget?
    If so you want to find a pline with 2 known vertex?
    Are you then interested in the 3 segments that share these vertex?
    Do you want to create 3 lines from this vertex information?

    Could you explain in more detail?

  3. #3
    100 Club
    Join Date
    2007-02
    Posts
    148
    Login to Give a bone
    0

    Default Re: SSget a Polyline via 1 of 2 intermediate points

    Quote Originally Posted by CAB2k
    I'm confused by your request. The title says ssget pline with one known vertex.
    But then you reference TWO points and talk about LINES.
    First do you want to use ssget?
    If so you want to find a pline with 2 known vertex?
    Are you then interested in the 3 segments that share these vertex?
    Do you want to create 3 lines from this vertex information?

    Could you explain in more detail?
    sorry if i confused you the 2 point 3 segment thing is just discribing what sort of polyline i am interested in. the ssget process will require the user to choose one of the 2 intermediate points (i.e. the points where all 3 lines are connected in the polyline). the program will then select that polyline. so nothing is created the polyline will already be existing in the drawing.

  4. #4
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: SSget a Polyline via 1 of 2 intermediate points

    Quote Originally Posted by tany0070
    sorry if i confused you . . .
    You are still confusing, an LWPOLYLINE with 3 segments "lines" do have four vertex "points".
    Here is a code that will display the coordinate point in the vertex closes to the selected point on the LWPOLYLINE.
    Code:
    (defun c:VerexPoint ( / Ent Vl_Obj PickP Param VerexP )
      (if (setq Ent (nentsel "\nCommand: Select a LWPOLYLINE near an vertex : " ) )
        (progn
          (setq Vl_Obj (vlax-ename->vla-object (car Ent )) )
          (setq PickP  (vlax-curve-getClosestPointTo Vl_Obj (cadr Ent ) nil ) )
          (setq Param  (fix (+ 0.5 (vlax-curve-getParamAtPoint Vl_Obj PickP ))) )
          (setq VerexP (vlax-curve-getPointAtParam Vl_Obj Param ) )
        )
        (princ ".. no object selected." )
      )
      (if VerexP VerexP (princ) )
    )
    : ) Happy Computing !

    kennet

  5. #5
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: SSget a Polyline via 1 of 2 intermediate points

    It sounds like you are looking to pick a segment of a lwpolyline. What I've done in the past is explode a copy saving the info needed from the segment that snaps to the pick point, then deleting all the newly created objects leaving the origional polyline untouched.
    Code:
     (princ "\nSelect Line, Arc or Polyline segment ")
     (setq ent (entsel))
     (vl-cmdf "undo" "BEgin")
     (setq eend (cdar(entget(entlast))) ; last entity
    	   pt   (cadr ent)   ; selection point
    	   ent  (car ent)   ; selected entity
    	   obj  (vlax-ename->vla-object ent)
    	   EnTyp (cdr(assoc 0 (cdr(entget ent)))); entity type
     )
    ;|Change pick point to midpoint to select newly created
      line instead of original polyline with width.
    ===========================================|;
     (vl-cmdf "point" "mid" pt)
     (setq pt(cdr(assoc 10(entget(entlast)))))
     (entdel(entlast))
     (vla-copy obj) ; Copy selected object.
     (setq SS (ssadd (entlast)))
     (if (= EnTyp "POLYLINE")(vl-cmdf "convertpoly" "Light" ss ""))
     (if(or(eq EnTyp "POLYLINE")(eq EnTyp "LWPOLYLINE"))
       (vl-cmdf "explode" (entlast)) ; Explode the copied object.
     )
     (setq elist (cdr(entget (ssname (ssget pt) 0))) ; Entity list of selected segment.
    	   EnTyp (cdr(assoc 0 elist)) ; Entity Type of selected segment.
     )
     (while(not(eq (entlast) eend))
      (entdel(entlast)) ; Delete everything that we added so far.
     )
    Of course if you know for sure you're looking for the second segment of the lwpolyline that would be easyer. You wouldn't need to make a copy just extract the information directly.

Similar Threads

  1. Intermediate points height for profile
    By aijazahmed in forum AutoLISP
    Replies: 23
    Last Post: 2014-05-03, 03:58 PM
  2. ssget closed polyline
    By rad.77676 in forum AutoLISP
    Replies: 31
    Last Post: 2009-04-16, 07:26 AM

Posting Permissions

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