Jean-Lévy Plante Posted October 22, 2019 Share Posted October 22, 2019 I would like to modify this lisp script so that the dimension has a centered text instead of on a side of the dimension. But i don't know how. (defun c:HD (/ HD_LineHouse HD_LineProperty HD_Point1 HD_BasePoint1 HD_Text1 HD_Point2 HD_BasePoint2 HD_Text2 HD_ActiveDoc HD_ActiveSpace) (if (and (setq HD_LineHouse (car (entsel "\nSelect house line : "))) (setq HD_LineProperty (car (entsel "\nSelect property boundary: "))) (= (vla-get-ObjectName (setq HD_LineHouse (vlax-ename->vla-object HD_LineHouse))) "AcDbLine") ) (progn (setq HD_LineProperty (vlax-ename->vla-object HD_LineProperty)) (if (not (vl-catch-all-error-p (setq HD_Point1 (vl-catch-all-apply 'vlax-curve-getClosestPointTo (list HD_LineProperty (setq HD_BasePoint1 (vlax-safearray->list (vlax-variant-value (vla-get-StartPoint HD_LineHouse))))))))) (progn (setq HD_Point2 (vlax-curve-getClosestPointTo HD_LineProperty (setq HD_BasePoint2 (vlax-safearray->list (vlax-variant-value (vla-get-EndPoint HD_LineHouse)))))) (setq HD_Text1 (polar HD_Point1 (angle HD_BasePoint1 HD_Point1) 0)) (setq HD_Text2 (polar HD_Point2 (angle HD_BasePoint2 HD_Point2) 0)) (vla-StartUndoMark (setq HD_ActiveDoc (vla-get-ActiveDocument (vlax-get-acad-object)))) (vla-put-TextPosition (vla-AddDimAligned (setq HD_ActiveSpace (vla-get-Block (vla-get-ActiveLayout HD_ActiveDoc))) (vlax-3d-point HD_BasePoint1) (vlax-3d-point HD_Point1) (vlax-3d-point HD_Point1)) (vlax-3d-point HD_Text1)) (vla-put-TextPosition (vla-AddDimAligned HD_ActiveSpace (vlax-3d-point HD_BasePoint2) (vlax-3d-point HD_Point2) (vlax-3d-point HD_Point2)) (vlax-3d-point HD_Text2)) (vla-EndUndoMark HD_ActiveDoc) (mapcar 'vlax-release-object (list HD_ActiveSpace HD_ActiveDoc)) ) ) ) ) (princ) ) HD-Automatic Dimension.LSP Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted October 23, 2019 Share Posted October 23, 2019 (setq HD_Text1 (polar HD_Point1 (angle HD_Point1 HD_BasePoint1) (* 0.5 (distance HD_BasePoint1 HD_Point1)))) (setq HD_Text2 (polar HD_Point2 (angle HD_Point2 HD_BasePoint2) (* 0.5 (distance HD_BasePoint2 HD_Point1)))) your polar function distance=0, try change to half i.e: distance between 2 points Quote Link to comment Share on other sites More sharing options...
Jean-Lévy Plante Posted October 23, 2019 Author Share Posted October 23, 2019 Thanks it worked Quote Link to comment Share on other sites More sharing options...
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.