Extend dimension to polyline and update text to layer lisp

Extend dimension to polyline and update text to layer lisp

Anonymous
Not applicable
973 Views
3 Replies
Message 1 of 4

Extend dimension to polyline and update text to layer lisp

Anonymous
Not applicable

Hi i am looking for a lisp where i can use the extend command to extend a dimension to a polyline and it will update dimension text to the layer that is set with a polyline some thing like this one that i have

 

 

(defun c:Sdim ( / ent te lay val olay p1 p2 ent1 ent2 lay1 lay2 newval edata)
(setq olay (getvar "clayer")
osmm (getvar "osmode")
)
(setvar "osmode" 512)
(setvar "clayer" "Existing-DIMENSIONS")
(setq p1 (getpoint"\nSelect first extension line origin: "))
(setvar "osmode" 128)
(setq p2 (getpoint p1 "\nSecond extension line origin: "))
(setvar "osmode" 512)
(setq ent1 (ssget p1)
ent2 (ssget p2)
)
(setvar "osmode" 0)
(if ent1(setq lay1 (cdr (assoc 8 (entget (ssname ent1 0))))) (setq lay1 ""))
(if ent2(setq lay2 (cdr (assoc 8 (entget (ssname ent2 0))))) (setq lay2 ""))
(setq te "")
(if (= lay1 "CENTERLINE") (setq lay lay2) (setq lay lay1))
(if lay
(cond ((= lay "Existing-WATERLINE")(setq te " W"))
((= lay "Existing-ROW") (setq te " R/W"))
((= lay "PAVEMENT") (setq te (strcase (strcat " " (getstring t "\nEnter Text "))
((= lay "Existing-SEWERLINE")(setq te " S"))
((= lay "SWGAS")(setq te " G"))
((= lay "Existing-ELECTRIC")(setq te " E"))
((= lay "TRENCH")(setq te " R/L"))
((= lay "Existing-STORMDRAIN") (setq te " SD"))
((= lay "TEL-E")(setq te " T"))
((= lay "TEL-P") (setq te " PROPOSED R/L"))
((= lay "EASEMENT") (setq te (strcase (strcat " " (getstring t "\nEnter Text ")))))
(t nil)
)
)
(if (= te " PROPOSED R/L")
(progn
(command ".layer" "n" "RL-DIM" "C" "42" "RL-DIM" "")(setvar "clayer" "rl-dim")
)
)
(command "_dimlinear" p1 p2 pause)
(setq ent (entlast)
edata (entget ent)
newval (strcat "<>" te)
edata (subst (cons 1 newval) (assoc 1 edata) edata)
)
(entmod edata)
(setvar "osmode" osmm)
(setvar "clayer" olay)
(princ)
)

the only thing is tis one is set to picking the fist point using the dimlinear command and i need a extend command  can anyone help me out with this

0 Likes
974 Views
3 Replies
Replies (3)
Message 2 of 4

devitg
Advisor
Advisor

@Anonymous For better understanding, and to get further help,  please upload such sample.dwg 

0 Likes
Message 3 of 4

Anonymous
Not applicable

in this dwg is the best example i can prove to explain the lisp i am looking for and action 

0 Likes
Message 4 of 4

Sea-Haven
Mentor
Mentor

Much simpler is write from scratch pick base line drag over other lines all lines dimensioned. Can have as many as you want.

 

Same with lookup make a list with 2 entries ((layer text)....) you can use foreach very fast to check.

screenshot238.png

0 Likes