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 ?


Recommended Posts

Posted

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 ?

apex.jpg

Posted (edited)

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
Posted (edited)
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
Posted

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
Posted

As a civil engineer there is a formula for the solution of IP point, so could do pick arc or pick arc in pline. 

 

image.thumb.png.d6789f85f882e2316250207f03fac87f.png

Posted

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
Posted (edited)

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
Posted

Steven P you can check which segment of a pline you picked so can get arc in pline. No code but big hint is Lee-mac pline properties.

  • Like 1
  • 2 weeks later...
Posted

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

Posted

No need to create a couple of new threads. It took 2 weeks to respond and now you're in a hurry?

Posted
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
Posted
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! 🍻

Posted

i need lisp for my problem.

please help me out this

Posted
5 hours ago, kkr028 said:

i need lisp for my problem.

please help me out this

Did you try the links I posted? https://www.theswamp.org/ is also a (donor supported) free site just like this one.

Posted

it is showing apex lines .

i want label like in above image

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...