Jump to content

Please help me poly line length from start with Curve up to tp-1(+) from tp-1 to IP distace (place as apex at km ?


kkr028

Recommended Posts

Rather then doing stupid math why not just make a copy then fillet with radius 0.

 

(setq poly (vlax-invoke (vlax-ename->vla-object ent) 'copy))
(setvar 'filletrad 0)
(vl-cmdf "_.Fillet" "P" (entlast))

 

Then its just 1+2 & 1+2+3

 

--EDIT

Then delete poly when done

Edited by mhupp
  • Like 1
Link to comment
Share on other sites

3 hours ago, mhupp said:

Rather then doing stupid math why not just make a copy then fillet with radius 0.

 

(setq poly (vlax-invoke (vlax-ename->vla-object ent) 'copy))
(setvar 'filletrad 0)
(vl-cmdf "_.Fillet" "P" (entlast))

 

Then its just 1+2 & 1+2+3

 

--EDIT

Then delete poly when done

 

 Just for fun... or like this if your lines are not polylines?

 

(defun c:testthis ( / )

  (setq frad (getvar 'filletrad))
  (setq line1 (car (entsel "\nSelect Line 1")))
  (setq line2 (car (entsel "\nSelect Line 2")))

  (setq pta (cdr (assoc 10 (entget line1))) )
  (setq ptb (cdr (assoc 11 (entget line1))) )
  (setq ptc (cdr (assoc 10 (entget line2))) )
  (setq ptd (cdr (assoc 11 (entget line2))) )

  (command "pline" pta ptb "")
  (setq pline1 entlast)
  (command "pline" ptc ptd "")
  (setq pline2 entlast)

  (setvar 'filletrad 5)
  (command "fillet" pta ptc)
  (setvar 'filletrad frad)

  (setq pline3 (entlast))
  (setq length1 (vlax-curve-getDistAtParam pline3 (vlax-curve-getEndParam pline3 )) )
  (entdel pline3)

  (princ "\Length: ")
  (princ length1)
  (princ)

)

 

Edited by Steven P
  • Like 1
Link to comment
Share on other sites

My attempt. :) 

(defun c:Apex ( / sel pts pt1 pt2 pt3 pt4 pt5 pt6 sg1 sg2)
  ;; Tharwat - 5.Mar.2022	;;
  (and (princ "\nSelect LWpolyline : ")
       (setq sel (ssget "_+.:S:E" '((0 . "LWPOLYLINE"))))
       (mapcar '(lambda (q) (and (= (car q) 10) (setq pts (cons (cdr q) pts)))) (reverse (entget (ssname sel 0))))
       (or (< 5 (length pts))
           (alert "Polyline should have at least 6 vertices to continue <!>")
           )
       (mapcar 'set '(pt1 pt2 pt3 pt4 pt5 pt6) pts)
       (setq sg1 (distance pt1 (inters pt1 pt2 pt4 pt3 nil))
             g2 (+ (distance pt1 pt2)
                   (distance pt3 (inters pt3 pt4 pt6 pt5 nil)))
             )
       )
  (list sg1 sg2)
  )
     

 

  • Like 2
Link to comment
Share on other sites

Coming back to this quickly, if the OP has a 'U' shaped polyline, with 2 or more filleted corners just selecting the polyline isn't going give the required apex ?

 

I read the question wrong last night and what I posted above isn't quite what is needed, I'll look at this later

 

  • Agree 1
Link to comment
Share on other sites

this will help you little bit

make polyline's curve to straight

 

even if curves are in end of polyline also

there's one problem with exist lisp which make radius to 0 value

in end of polyline

 

Edited by exceed
Link to comment
Share on other sites

  • 2 weeks later...

actually i need this

TP1 length = Curve polyline length up to every TP-1 and place text as " TP-1@ ??.??? KM' "
TP2 length = Curve polyline length up to every TP-2 and place text as " TP-2@ ??.??? KM' "
APEX length = (Curve polyline length up to every TP-1 + tangent length and place text as " APEX-? AT ??.??? KM "
FORWARD BARRING = place text as " FB : ???° ??' ?? "
 

 CURVE-Model0001.jpg.1e76c2c7c3d9fd916cca89cbb3287d09.jpgCURVE-Model.pdf

Link to comment
Share on other sites

20 minutes ago, ronjonp said:

HA! I knew I had written something for this but couldn't find it! :)

Glad to help, it was easy to find as I've probably got as much of your code referenced in my CUIX as you do!

 

I enjoy writing lisp as well but time is money. Anytime Google can find a quick solution online from a guru I trust it's added to my collection referenced to where and from whom I got it!

Thanks again,

  • Agree 1
Link to comment
Share on other sites

3 hours ago, tombu said:

Glad to help, it was easy to find as I've probably got as much of your code referenced in my CUIX as you do!

 

I enjoy writing lisp as well but time is money. Anytime Google can find a quick solution online from a guru I trust it's added to my collection referenced to where and from whom I got it!

Thanks again,

Glad you could use the code I've provided. I'd hardly consider myself a 'guru' but thanks! 🍻

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...