Sheep Posted August 18, 2020 Posted August 18, 2020 1. Hi all. How do i extract the length and angle from the command LENGTHEN? I throw in this code: (setq data_radius (entsel "\nPick a curve:")) 2. When i tried using : (command "LENGTHEN" data_radius "" "") Acad still asking me to select the curve. But if i put in !data_radius in the commandprompt, LENGTHEN accepts it. Can someone point me the right direction? Thanks. Quote
Tharwat Posted August 18, 2020 Posted August 18, 2020 The length in the following example is: 2.5 as declared in the command call: (setq data_radius (entsel "\nPick a curve:")) (command "LENGTHEN" "" "2.5" (car data_radius) "" "") 1 Quote
Sheep Posted August 18, 2020 Author Posted August 18, 2020 6 minutes ago, Tharwat said: The length in the following example is: 2.5 as declared in the command call: (setq data_radius (entsel "\nPick a curve:")) (command "LENGTHEN" "" "2.5" (car data_radius) "" "") Hi Tharwat. When i run the LENGTHEN command, it will ask to pick an object ( in this case a curve). It will display the length and the angle. Can you guide me on how to extract the length and the angle? Quote
Tharwat Posted August 18, 2020 Posted August 18, 2020 I have no idea but they should be saved as system or environment variable. Quote
Sheep Posted August 18, 2020 Author Posted August 18, 2020 1 hour ago, Tharwat said: I have no idea but they should be saved as system or environment variable. How about LIST command? Or it's the same case? Can getvar retrieve the info? Quote
dlanorh Posted August 18, 2020 Posted August 18, 2020 1 hour ago, Sheep said: How about LIST command? Or it's the same case? Can getvar retrieve the info? Try this old lisp of mine (defun c:arcd (/ el tau r sa ea ia len) (setq el (entget (car (entsel "\nSelect Arc : "))) tau (* pi 2.0) r (cdr (assoc 40 el)) sa (cdr (assoc 50 el)) ea (cdr (assoc 51 el)) ) (if (> sa ea) (setq ia (+ (- tau sa) ea)) (setq ia (- ea sa))) (setq len (* r ia)) (alert (strcat "Arc Data : \n" "\nLength : " (rtos len 2 3) "\n\nIncl Angle : " (angtos ia 1 4))) ) 1 Quote
Sheep Posted August 18, 2020 Author Posted August 18, 2020 (edited) 54 minutes ago, dlanorh said: Try this old lisp of mine (defun c:arcd (/ el tau r sa ea ia len) (setq el (entget (car (entsel "\nSelect Arc : "))) tau (* pi 2.0) r (cdr (assoc 40 el)) sa (cdr (assoc 50 el)) ea (cdr (assoc 51 el)) ) (if (> sa ea) (setq ia (+ (- tau sa) ea)) (setq ia (- ea sa))) (setq len (* r ia)) (alert (strcat "Arc Data : \n" "\nLength : " (rtos len 2 3) "\n\nIncl Angle : " (angtos ia 1 4))) ) By looking at your code, now i know my mistake. I used assoc 10 & 11 instead assoc 50 & 51. I'll try tomorrow. Thank you. Btw, what is assoc 40 for? Edited August 18, 2020 by Sheep Quote
dlanorh Posted August 18, 2020 Posted August 18, 2020 4 minutes ago, Sheep said: By looking at your code, now i know my mistake. I used assoc 10 & 11 instead assoc 50 & 51. I'll try tomorrow. Thank you. Btw, what is assoc 40 for? 40 is the radius of the arc, 50 the start angle of the start point and 51 the end angle of the end point. Both angles are in radians and measured at the centre point. The (if (> sa ea)...) is needed in case the start angle is greater than the end angle (the arc passes through 0 (zero) radians). Arcs and circles are always counter clockwise irrespective of how they are constructed 1 Quote
BIGAL Posted August 18, 2020 Posted August 18, 2020 Something I have been playing with. All welcome to add comment good or bad, a work in progress. Needs arc to be added. Probably change cords to use an ent and assoc 10. ; Pline properties use as a library function ; By Alan H july 2020 (defun cords (obj / co-ords xy ) (setq coordsxy '()) (setq co-ords (vlax-get obj 'Coordinates)) (setq numb (/ (length co-ords) 2)) (setq I 0) (repeat numb (setq xy (list (nth (+ I 1) co-ords)(nth I co-ords) )) (setq coordsxy (cons xy coordsxy)) (setq I (+ I 2)) ) ) (defun AH:chkcwccw (obj / objplnew area1 area2 minpoint maxpoint oldsnap) (setq oldsnap (getvar 'osmode)) (setvar 'osmode 0) (vla-GetBoundingBox obj 'minpoint 'maxpoint) (setq pointmin (vlax-safearray->list minpoint)) (setq pointmax (vlax-safearray->list maxpoint)) (setq dist (/ (distance pointmin pointmax) 20.0)) (vla-offset obj dist) (setq objplnew (vlax-ename->vla-object (entlast))) (setq area1 (vlax-get objplnew 'Area)) (vla-delete objplnew) (vla-offset obj (- dist)) (setq objplnew (vlax-ename->vla-object (entlast))) (setq area2 (vlax-get objplnew 'Area)) (vla-delete objplnew) (if (> area1 area2) (setq cw "Clockwise") (setq cw "Anti") ) (setvar 'osmode oldsnap) ) ; thanks to Lee-mac for this defun ; www.lee-mac.com ; 44 is comma (defun _csv->lst ( str / pos ) (if (setq pos (vl-string-position 44 str)) (cons (substr str 1 pos) (_csv->lst (substr str (+ pos 2)))) (list str) ) ) (defun plprops (obj txt / lst) (setq lst (_csv->lst txt)) (foreach val lst (cond ((= (strcase val) "LAY") (setq lay (vla-get-layer obj))) ((= (strcase val) "AREA")(setq area (vla-get-area obj))) ((= (strcase val) "START")(setq start (vlax-curve-getstartpoint obj))) ((= (strcase val) "END" (strcase txt))(setq end (vlax-curve-getendpoint obj))) ((= (strcase val) "LEN" (strcase txt))(setq len (vlax-get obj 'Length))) ((= (strcase val) "CW" (strcase txt))(AH:chkcwccw obj)) ((= (strcase val) "CORDS" (strcase txt))(CORDS obj)) ) ) ) (defun lineprops (obj txt / lst) (setq lst (_csv->lst txt)) (foreach val lst (cond ((= (strcase val) "LAY") (setq lay (vlax-get obj 'layer))) ((= (strcase val) "START")(setq start (vlax-get obj 'startpoint))) ((= (strcase val) "END" (strcase txt))(setq end (vlax-get obj 'endpoint))) ((= (strcase val) "LEN" (strcase txt))(setq len (vlax-get obj 'Length))) ) ) ) (defun circprops (obj txt / lst) (setq lst (_csv->lst txt)) (foreach val lst (cond ((= (strcase val) "LAY") (setq lay (vlax-get obj 'layer))) ((= (strcase val) "LEN" (strcase txt))(setq len (vlax-get obj 'Circumference))) ((= (strcase val) "RAD" (strcase txt))(setq rad (vla-get-radius obj))) ((= (strcase val) "CEN" (strcase txt))(setq cen (vlax-get obj 'Center))) ((= (strcase val) "AREA" (strcase txt))(setq area (vlax-get obj 'area))) ) ) ) ; starts here (setq ent (vlax-ename->vla-object (car (entsel "Pick Object ")))) ; do a check for object type then use a cond ; pick an example below ; many examples copy to command line for testing mix and match ; (plprops ent "LAY")(princ lay) ; (plprops ent "END")(princ end) ; (plprops ent "START")(princ start) ; (plprops ent "END,START")(princ end)(princ start) ; (plprops ent "AREA,LAY,END,START")(princ area)(princ lay)(princ end)(princ start) ; (plprops ent "START,AREA,LAY,CW")(princ start)(princ area)(princ cw) ; (plprops ent "start,END,CORDS,cw")(princ start)(princ end)(princ coordsxy)(princ cw) ; (plprops ent "CW")(princ cw) ; (plprops ent "AREA")(princ area) ; (plprops ent "CORDS")(princ coordsxy) ; (lineprops ent "len")(princ len) ; (lineprops ent "len,lay")(princ len)(princ lay) ; (lineprops ent "lay,end,start,len")(princ len)(princ lay)(princ start)(princ end) ; (circprops ent "lay,rad,area,cen")(princ lay)(princ rad)(princ area)(princ cen) ; (circprops ent "lay,rad") 1 Quote
Sheep Posted August 19, 2020 Author Posted August 19, 2020 From now on, i'll post an update about my learning progress. I think this is a way to (at least ) display my gratitude to those who responds and to the forum. Thank you. Is it possible to make a multiline of text using MTEXT with tab spacing (Index <tab> X:123.00) Quote
BIGAL Posted August 19, 2020 Posted August 19, 2020 (edited) This was done about 1985 plus a couple of others. Its part of a bundle of programs will find an index page have a paper copy not a electronic will scan. Have the kerb 1/4 point setout somwhere, but and a big BUT it is not relevant having worked as a setout surveyor on roads you set out the 1/4 points based on a start and end peg that is offset from the back of the kerb so different values. Now use a GPS have smart offset calcs built in. Edited August 19, 2020 by BIGAL 1 Quote
Sheep Posted August 19, 2020 Author Posted August 19, 2020 16 minutes ago, BIGAL said: This was done about 1985 plus a couple of others. Its part of a bundle of programs will find an index page have a paper copy not a electronic will scan. Have the kerb 1/4 point setout somwhere, but and a big BUT it is not relevant having worked as a setout surveyor on roads you set out the 1/4 points based on a start and end peg that is offset from the back of the kerb so different values. Now use a GPS have smart offset calcs built in. I'm making a lisp for a small curve with not so many calculation. Anything that is above radius 80m@speed of 100 km/ph must apply a different set of calculation. Quote
Recommended Posts
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.