Jump to content

Perpendicular lines from points


erbalaji

Recommended Posts

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.

LISP.jpg

Link to comment
Share on other sites

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 by BIGAL
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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