erbalaji Posted January 15, 2018 Posted January 15, 2018 Hello Engineers I wish to get a help from you regarding taking measurements in between two lines. my requirements are Generate points at 1m generate perpendicular lines from its base location extend till the magenta line give line length. can you guys help me? Kindly see the attachment. Thank you. Quote
BIGAL Posted January 15, 2018 Posted January 15, 2018 (edited) This is known in civil engineering as Peg & shift. The code is pretty straight forward, just checking something I have. Try this it is a start. If you want it all dimensioned etc then thats a biggger task. ; simple peg & shift at constant distance ; By Alan H Jan 2018 (defun chktstyle ( / ) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (setq cursty (getvar "textstyle")) (setq stys (vla-get-textstyles doc)) (vlax-for sty stys (if (= cursty (vla-get-name sty)) (setq ht (vla-get-height sty)) ) (if (and (/= ht nil)(> ht 0.0))(setq tsy "Y")(setq ht 2.5)) ) ) (defun pegoff ( / len len2 newpt ang ht) (setq newPt (vlax-curve-getClosestPointTo Obj2 Pt)) (setq len2 (distance newpt pt)) (setq ang (angle newpt pt)) (command "line" newpt pt "") (chktstyle) (if (= tsy "Y") (command "Text" pt ang (rtos len2 2 2)) (command "Text" pt ht ang (rtos len2 2 2)) ) ;(alert (strcat "The ch is " (rtos ch 2 2) "\n\nOffset is " (rtos len2 2 2))) ; dummy to see something ) (defun pegsh ( / obj obj2 lstch num olen inc) (setq obj (vlax-ename->vla-object (car (entsel "\nPick peg line" )))) (setq obj2 (vlax-ename->vla-object (car (entsel "\nPick offset line")))) (setq olen (vla-get-length obj)) (setq inc (getreal "\nEnter your increment")) (setq num (fix (/ olen inc))) (setq lstch (list 0.0)) ; accept 1st pointc (setq ch 0.0) (repeat num (setq lstch (cons (setq ch (+ ch inc)) lstch)) ) (setq lstch (cons olen lstch)) (repeat (setq x (length lstch)) (setq ch (nth (setq x (- x 1)) lstch)) (setq pt (vlax-curve-getpointatdist obj ch)) (pegoff) ) ) ;defun pegsh (setq oldsnap (getvar 'osmode)) (SETQ ANGBASEE (GETVAR "ANGBASE")) (SETQ ANGDIRR (GETVAR "ANGDIR")) (SETQ AUNITSS (GETVAR "AUNITS")) (setq luprecc (GETVAR "LUPREC" )) (SETVAR "ANGBASE" 0.0) (SETVAR "ANGDIR" 0) (SETVAR "LUPREC" 3) (SETVAR "AUNITS" 3) (setvar 'osmode 0) (pegsh) (setvar 'osmode oldsnap) (SETVAR "ANGBASE" angbasee) (SETVAR "ANGDIR" angdirr) (SETVAR "LUPREC" luprecc) (SETVAR "AUNITS" aunitss) Edited January 16, 2018 by BIGAL Quote
erbalaji Posted January 15, 2018 Author Posted January 15, 2018 thank you so much Bigul i wish to remain the value at end or start of line, instead of displaying in a window no need of dimensioning. can you modify this lisp please? thank a lot Quote
BIGAL Posted January 16, 2018 Posted January 16, 2018 (edited) The code above has been updated I will leave it to you to play with the exact text location, also not it expects text style to have height set. Put a fix in for text ht as zero you may want to change the 2.5. Edited January 16, 2018 by BIGAL 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.