Grigs Posted February 27, 2013 Posted February 27, 2013 Does anyone have to know of a lisp routine that will allow someone to pick an extension line and change it to CENTER? Quote
Tharwat Posted February 27, 2013 Posted February 27, 2013 Does it mean that you want to reduce the length of a line to its center point ? Quote
Grigs Posted February 27, 2013 Author Posted February 27, 2013 No, I want to be able to pick one of the extension lines and change it to CENTER type. Ideally, it would be nice to have the option to change it's LTSCALE as well. Quote
Tharwat Posted February 27, 2013 Posted February 27, 2013 (edited) (defun c:Foo (/ sel Doc) (vl-load-com) (setq Doc (vla-get-ActiveDocument (vlax-get-acad-object))) (if (and (setq sel (car (nentsel "\n Select extension line on dimension :")) ) (eq (cdr (assoc 0 (entget sel))) "LINE") ) (progn (if (not (tblsearch "LTYPE" "CENTER")) (vla-load (vla-get-Linetypes Doc) "CENTER" "acadiso.lin" ) ) (vla-put-Linetype (vlax-ename->vla-object sel) "CENTER") (vla-regen Doc AcAllViewports) ) ) (princ) ) Edited February 27, 2013 by Tharwat Quote
Grigs Posted February 27, 2013 Author Posted February 27, 2013 That works on regular entities but not dimension extension lines Quote
Tharwat Posted February 27, 2013 Posted February 27, 2013 that works on regular entities but not dimension extension lines codes updated above . Quote
Grigs Posted February 27, 2013 Author Posted February 27, 2013 That works. Is there a way to only change the extension line that was picked? Quote
Grigs Posted February 28, 2013 Author Posted February 28, 2013 Close. But it doesn't change the extension line. Quote
Tharwat Posted February 28, 2013 Posted February 28, 2013 Close. But it doesn't change the extension line. What kind of extension line you are talking about ? Quote
Grigs Posted February 28, 2013 Author Posted February 28, 2013 Either the left or right extension line in a dimension. Quote
Tharwat Posted February 28, 2013 Posted February 28, 2013 Change the ltscale to see the changes . Quote
Grigs Posted February 28, 2013 Author Posted February 28, 2013 It will change a regular line to Center but not the extension line of a linear dimension, which I am trying to achieve. Quote
Tharwat Posted February 28, 2013 Posted February 28, 2013 It will change a regular line to Center but not the extension line of a linear dimension, which I am trying to achieve. That's not correct , upload a sample drawing and indicate to the extension line that you're talking about in the drawing . Quote
Grigs Posted February 28, 2013 Author Posted February 28, 2013 Drawing3.dwg Ok. Here is a sample. It makes no difference which one i choose. Quote
Tharwat Posted February 28, 2013 Posted February 28, 2013 The code does the trick as needed but the issue is with the line type scale , so I added one line of code to scale all extension lines with the same value , and after that you can play with the ltscale and it would change all of them with the same gap distance . (defun c:Foo (/ sel Doc) (vl-load-com) (setq Doc (vla-get-ActiveDocument (vlax-get-acad-object))) (if (and (setq sel (car (nentsel "\n Select extension line on dimension :")) ) (eq (cdr (assoc 0 (entget sel))) "LINE") ) (progn (if (not (tblsearch "LTYPE" "CENTER")) (vla-load (vla-get-Linetypes Doc) "CENTER" "acadiso.lin" ) ) (vla-put-Linetype (vlax-ename->vla-object sel) "CENTER") (vla-put-Linetypescale (vlax-ename->vla-object sel) 1.0) (vla-regen Doc AcAllViewports) ) ) (princ) ) Quote
Grigs Posted February 28, 2013 Author Posted February 28, 2013 Odd. When I run the routine and pick an extension line and then look at the properties of it, nothing has changed. The linetype of the extension line is still ByLayer and the LTScale is still 1 Quote
Tharwat Posted February 28, 2013 Posted February 28, 2013 Odd. When I run the routine and pick an extension line and then look at the properties of it, nothing has changed. The linetype of the extension line is still ByLayer and the LTScale is still 1 Really odd , check the Line Type Control , the "LTYPE" Table - do you have the Center ltype property in that table after running the code ? Quote
Grigs Posted February 28, 2013 Author Posted February 28, 2013 Yeah, I have the necessary linetypes loaded in the drawing. Quote
Lee Mac Posted February 28, 2013 Posted February 28, 2013 (edited) Try this: (defun c:extlt ( / ent enx ltp obj pnt ) (setq ltp "CENTER") (if (tblsearch "LTYPE" ltp) (progn (while (progn (setvar 'errno 0) (setq ent (entsel "\nSelect Extension Line: ")) (cond ( (= 7 (getvar 'errno)) (princ "\nMissed, try again.") ) ( (null ent) nil) ( (not (wcmatch (cdr (assoc 0 (entget (car ent)))) "*DIMENSION")) (princ "\nSelected object is not a Dimension: ") ) ) ) ) (if ent (progn (setq pnt (trans (cadr ent) 1 0) enx (entget (car ent)) obj (vlax-ename->vla-object (car ent)) ) (vlax-put-property obj (if (< (distance pnt (cdr (assoc 13 enx))) (distance pnt (cdr (assoc 14 enx)))) 'extline1linetype 'extline2linetype ) ltp ) ) ) ) (princ (strcat "\nLinetype " ltp " not loaded.")) ) (princ) ) (vl-load-com) (princ) Edited June 3, 2019 by Lee Mac Quote
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.