Hi all,
I need to create a text from a propertie of the line (propertie name from OD group) and integrate it on a lsp file.
I've this lsp file that do half of the job:
(defun C:LTR (/ lin lindata txt txtdata end1 end2 ang mid)
(setvar 'cmdecho 0)
(while
(not
(and
(setq lin (car (entsel "\n Select LINE with Correct Angle: ")))
(if lin (setq lindata (entget lin)))
(= (cdr (assoc 0 lindata)) "LINE")
); end and
); end not
(prompt "\nNothing selected, or not a Line -- try again.")
); end while
(redraw lin 3)
(while
(not
(and
(setq txt (car (entsel "\n Select TEXT to center on and align with Line: ")))
(if txt (setq txtdata (entget txt)))
(= (cdr (assoc 0 txtdata)) "TEXT")
(= (cdr (assoc 70 (tblsearch "layer" (cdr (assoc 8 txtdata))))) 0); unlocked Layer
); end and
); end not
(prompt "\nNothing selected, or not Text, or on a locked Layer -- try again.")
); end while
(setq
end1 (cdr (assoc 10 lindata))
end2 (cdr (assoc 11 lindata))
ang (angle end1 end2)
mid (mapcar '/ (mapcar '+ end1 end2) '(2 2 2))
); end setq
(if (< (/ pi 2) ang (* pi 1.5)) (setq ang (+ ang pi))); Text in more upright direction
(setq
txtdata (subst (cons 50 ang) (assoc 50 txtdata) txtdata); rotation
txtdata (subst '(72 . 1) (assoc 72 txtdata) txtdata); justification Center
txtdata (subst '(73 . 0) (assoc 73 txtdata) txtdata); justification [0 for plain Center, 1 for Bottom Center]
); end setq
(entmod txtdata)
(command; avoids need to calculate (assoc 10) value for (subst)
"_.move" txt ""
(cdr (assoc 11 txtdata)); original insertion point
(polar mid (+ ang (/ pi 2)) (getvar 'dimscale)); new insertion point
); end command
(redraw lin 4)
(setvar 'cmdecho 1)
(princ)
); end defun
But I need that the text used was generated from the line.
Solved! Go to Solution.
Hi all,
I need to create a text from a propertie of the line (propertie name from OD group) and integrate it on a lsp file.
I've this lsp file that do half of the job:
(defun C:LTR (/ lin lindata txt txtdata end1 end2 ang mid)
(setvar 'cmdecho 0)
(while
(not
(and
(setq lin (car (entsel "\n Select LINE with Correct Angle: ")))
(if lin (setq lindata (entget lin)))
(= (cdr (assoc 0 lindata)) "LINE")
); end and
); end not
(prompt "\nNothing selected, or not a Line -- try again.")
); end while
(redraw lin 3)
(while
(not
(and
(setq txt (car (entsel "\n Select TEXT to center on and align with Line: ")))
(if txt (setq txtdata (entget txt)))
(= (cdr (assoc 0 txtdata)) "TEXT")
(= (cdr (assoc 70 (tblsearch "layer" (cdr (assoc 8 txtdata))))) 0); unlocked Layer
); end and
); end not
(prompt "\nNothing selected, or not Text, or on a locked Layer -- try again.")
); end while
(setq
end1 (cdr (assoc 10 lindata))
end2 (cdr (assoc 11 lindata))
ang (angle end1 end2)
mid (mapcar '/ (mapcar '+ end1 end2) '(2 2 2))
); end setq
(if (< (/ pi 2) ang (* pi 1.5)) (setq ang (+ ang pi))); Text in more upright direction
(setq
txtdata (subst (cons 50 ang) (assoc 50 txtdata) txtdata); rotation
txtdata (subst '(72 . 1) (assoc 72 txtdata) txtdata); justification Center
txtdata (subst '(73 . 0) (assoc 73 txtdata) txtdata); justification [0 for plain Center, 1 for Bottom Center]
); end setq
(entmod txtdata)
(command; avoids need to calculate (assoc 10) value for (subst)
"_.move" txt ""
(cdr (assoc 11 txtdata)); original insertion point
(polar mid (+ ang (/ pi 2)) (getvar 'dimscale)); new insertion point
); end command
(redraw lin 4)
(setvar 'cmdecho 1)
(princ)
); end defun
But I need that the text used was generated from the line.
Solved! Go to Solution.
Solved by CADaSchtroumpf. Go to Solution.
Post dwg with the example of such attributed line and desired output.
Post dwg with the example of such attributed line and desired output.
Here is an example.
I need to generate a text with the attribute name of the red lines on click, with the same situations as the line.
The red lines without this attribute dont need to do nothing. Actually i'm using and setting the command MAPANNTEMPLATE and MAPANNINSERT but a lot of texts came desconfigured and I don't all texts, because that, the generation on click will save me.
Here is an example.
I need to generate a text with the attribute name of the red lines on click, with the same situations as the line.
The red lines without this attribute dont need to do nothing. Actually i'm using and setting the command MAPANNTEMPLATE and MAPANNINSERT but a lot of texts came desconfigured and I don't all texts, because that, the generation on click will save me.
Hi,
After have loaded the two lisp.
Select ONE polyline by grips what have a the table "Santa_Cruz_do_Capibaribe_"
In line command write the command : sel_by_od
Choose the table "Santa_Cruz_do_Capibaribe_"
and for the name, change the name finded by "*" (jocker)
The fonction must select 706 polylines with grips what have the table "Santa_Cruz_do_Capibaribe_" and a different name.
Then in line command write the command : OD2Label_Side
Select the field name.
Give for exemple an heigth of text at 3.5 units, and job is finish...
Hi,
After have loaded the two lisp.
Select ONE polyline by grips what have a the table "Santa_Cruz_do_Capibaribe_"
In line command write the command : sel_by_od
Choose the table "Santa_Cruz_do_Capibaribe_"
and for the name, change the name finded by "*" (jocker)
The fonction must select 706 polylines with grips what have the table "Santa_Cruz_do_Capibaribe_" and a different name.
Then in line command write the command : OD2Label_Side
Select the field name.
Give for exemple an heigth of text at 3.5 units, and job is finish...
Thank you! This will help me a lot.
Has a way to make the appears seven metters perpendicular from the origin line and/or set his height in seven metters?
Thank you! This will help me a lot.
Has a way to make the appears seven metters perpendicular from the origin line and/or set his height in seven metters?
I introduced a write offset in the code (Déport pour l'écriture? <0.0>:)
I introduced a write offset in the code (Déport pour l'écriture? <0.0>:)
Can't find what you're looking for? Ask the community or share your knowledge.