Hi Everyone, is there a lisp routine to rotate the dimension text 90 degree to the dimension line when placing the dimension? so that the CAD user can dimension the lane width without rotate the ucs. Thanks.
Solved! Go to Solution.
Solved by CNinBC. Go to Solution.
@CNinBC ,
I will need some further explanation to better understand your request.
- Are you just wanting a special command that will always create a dimension with text parallel to the road lines?
- How is your dim style setup? (is text "Horizontal" or "Aligned with dimension line"?)
- Your dimension circled in your image has no dimension lines, ticks, or arrows.. Does this mean you only want to show the distance and not the dimension?
Best,
~DD
Try this
(defun c:dimtext90 ( / obj pt1 pt2 ang) (setq obj (vlax-ename->vla-object (car (entsel "\nSelect Aligned Dim : "))) pt1 (vlax-get obj 'extline1point) pt2 (vlax-get obj 'extline2point) ang (+ (angle pt1 pt2) (* pi 0.5)) ) (vlax-put-property obj 'textrotation ang) );end_defun
I am not one of the robots you're looking for
Thanks for your reply, please see my respond attached below in red.
@CodeDing wrote:
@CNinBC ,
I will need some further explanation to better understand your request.
- Are you just wanting a special command that will always create a dimension with text parallel to the road lines? Yes
- How is your dim style setup? (is text "Horizontal" or "Aligned with dimension line"?) can be either one
- Your dimension circled in your image has no dimension lines, ticks, or arrows.. Does this mean you only want to show the distance and not the dimension? correct, i only need to show the dimension text for the lane width.
Best,
~DD
I am not one of the robots you're looking for
Thanks @dlanorh, I modified your lisp routine slightly to consider the readable angle of the dimension text.
(defun c:dimtext90 ( / obj pt1 pt2 ang) (setq obj (vlax-ename->vla-object (car (entsel "\nSelect Aligned Dim : "))) pt1 (vlax-get obj 'extline1point) pt2 (vlax-get obj 'extline2point) ang (if (> (angle pt1 pt2) pi) (+ (angle pt1 pt2) (* pi 0.5)) (- (angle pt1 pt2) (* pi 0.5))) ) (vlax-put-property obj 'textrotation ang) );end_defun
Little different version.
(defun c:DimAlignedVert ( / en) (command "_.DIMALIGNED" pause pause "@") (setq en (entlast)) (setpropertyvalue en "TextRotation" (+ (angle (list (getpropertyvalue en "XLine1Point/X") (getpropertyvalue en "XLine1Point/Y")) (list (getpropertyvalue en "XLine2Point/X") (getpropertyvalue en "XLine2Point/Y"))) (* pi 0.5))) (command-s "_.DIMTEDIT" en) (princ) )
I tried to use (getpropertyvalue)... it's not as nice as I hoped... but it works. Anyhow, this is not what this idea is about.
Thanks @ВeekeeCZ , if this program can maintain dimension readable, that will be perfect.
@ВeekeeCZ wrote:
Little different version.
(defun c:DimAlignedVert ( / en) (command "_.DIMALIGNED" pause pause "@") (setq en (entlast)) (setpropertyvalue en "TextRotation" (+ (angle (list (getpropertyvalue en "XLine1Point/X") (getpropertyvalue en "XLine1Point/Y")) (list (getpropertyvalue en "XLine2Point/X") (getpropertyvalue en "XLine2Point/Y"))) (* pi 0.5))) (command-s "_.DIMTEDIT" en) (princ) )I tried to use (getpropertyvalue)... it's not as nice as I hoped... but it works. Anyhow, this is not what this idea is about.
I also modified the code to consider the readable angle. Thanks everyone.
(defun c:DimAlignedVert ( / en) (command "_.DIMALIGNED" pause pause "@") (setq en (entlast)) (setq DimAngle (angle (list (getpropertyvalue en "XLine1Point/X") (getpropertyvalue en "XLine1Point/Y")) (list (getpropertyvalue en "XLine2Point/X") (getpropertyvalue en "XLine2Point/Y")))) (if (> DimAngle pi) (Setq DimAngle (+ DimAngle (* pi 0.5))) (setq DimAngle (- DimAngle (* pi 0.5)))) (setpropertyvalue en "TextRotation" DimAngle) (command-s "_.DIMTEDIT" en) (princ) )
Can't find what you're looking for? Ask the community or share your knowledge.