All Activity
- Past hour
-
3dwannab started following Change plotstyles display on all currently open docs?
-
Change plotstyles display on all currently open docs?
3dwannab posted a topic in AutoLISP, Visual LISP & DCL
Hi all, Here's a function that doesn't work to set the plot styles for all open drawings. Is there something I'm missing? (defun set-pstyles (showBool / app docs orgDoc) (setq showBool (if showBool :vlax-true :vlax-false)) (setq app (vlax-get-acad-object)) (setq docs (vla-get-Documents app)) (setq orgDoc (vla-get-ActiveDocument app)) ; store the original (vlax-for d docs (vla-Activate d) (vla-put-ShowPlotStyles (vla-get-ActiveLayout d) showBool) (vla-Regen d acActiveViewport) ) (vla-Activate orgDoc) ) (set-pstyles T) ; (set-pstyles nil) - Today
-
Get length of MLeader/QLeader spline.
SLW210 replied to SLW210's topic in AutoLISP, Visual LISP & DCL
I thought I posted this yesterday. Yes, DOGLEGLENGTH is the landing, they should all be 0, but to make sure, it needs accounted for. May need to dig into something deeper. It's not a super important deal at the moment, I was just curious as to why it's so obscure for methods to manipulate Multileaders/Leaders without exploding. I have no Mtext, just have some routes, and would like them to match lengths, I need the arrow to relocate, not the landing. I have posted a test drawing. For future work, drawing them to a specific length would be nice, that seems to be what 1958's LISP does, still trying to decipher it though. P.S. After some testing, ml.lsp asks to select a line and then draws an Mleader and places text for the length, best I can decipher. MLeader Test.dwg -
Get length of MLeader/QLeader spline.
BIGAL replied to SLW210's topic in AutoLISP, Visual LISP & DCL
I don't think dogleglength is what you want. This example is original mleader was 33 tried dogleglength at 35 can see is way to long. Like twice the length required. it was like 70+ The only way I have found is to move either the 1st or last point and can get the desired spline length, but a big but must explode and recalc the spline point and then undo and reset the mleader then its length is correct. Or within say 1e-03 etc. I have not found a way to get a length of a mleader spline. Some one else may know. The default dogleg length is in the Mleaderstyle, I have started to play with it set to 0.0 asked me it makes it easier to work out lengths. Starting to look at making a spline so can easy recalc without any explodes. This shows in red what I consider the spline length. Note have to add arrow size. Please confirm. Can you also post a dwg with sample mleaders. -
yes you can. Add a filter for wall using Type Name and apply that filter in View. hit VG and edit the filter CUT Properties according to your liking. Turn off Thin Lines to check the line thickness.
-
LISP to select lines and text according to "Z" values
shokoufeh replied to shokoufeh's topic in AutoLISP, Visual LISP & DCL
WOW. Great. It works Thank you -
LISP to select lines and text according to "Z" values
shokoufeh replied to shokoufeh's topic in AutoLISP, Visual LISP & DCL
I applied this and the problem is solved for Hatches, too. Thank you -
Get length of MLeader/QLeader spline.
Tsuky replied to SLW210's topic in AutoLISP, Visual LISP & DCL
@SLW210 You are rigth this is the good direction for your ask. Try this (defun c:length2lead ( / AcDoc Space ss dog_l n sel obj) (setq AcDoc (vla-get-ActiveDocument (vlax-get-acad-object)) Space (if (= 1 (getvar "CVPORT")) (vla-get-PaperSpace AcDoc) (vla-get-ModelSpace AcDoc) ) ) (vla-startundomark AcDoc) (princ "\nSelect mleader") (while (not (setq ss (ssget (list '(0 . "MULTILEADER") (cons 67 (if (eq (getvar "CVPORT") 1) 1 0)) (cons 410 (if (eq (getvar "CVPORT") 1) (getvar "CTAB") "Model")) ) ) ) ) ) (initget 7) (setq dog_l (getdist (getvar "VIEWCTR") "nNew length for multileader?: ")) (repeat (setq n (sslength ss)) (setq sel (ssname ss (setq n (1- n))) obj (vlax-ename->vla-object sel) ) (vla-put-DoglegLength obj dog_l) (vla-regen AcDoc acactiveviewport) ) (vla-endundomark AcDoc) (prin1) ) -
Get length of MLeader/QLeader spline.
BIGAL replied to SLW210's topic in AutoLISP, Visual LISP & DCL
As I suggested can move the vertices and return the new length or say draw something and move say the first point keep repeating till it is the length you want. Will have a play. - Yesterday
-
TEXT HEIGHT VALUE FOR ARCHITECHTURAL UNIT IN TEXT TAB OF DIMSTYLE MANAGER DILOG
SLW210 replied to LIU's topic in AutoCAD Beginners' Area
If Architectural units are being used, entering 2.6 in the Text Height box would make the text 2.6" in Architectural format that's shown as 2- 15/32". The equivalent to 2.6mm text height for Architectural is 1/8" or .125". -
Get length of MLeader/QLeader spline.
SLW210 replied to SLW210's topic in AutoLISP, Visual LISP & DCL
But wouldn't undo change it back to original length? Still looking to decipher this one, probably tomorrow when I get back to work. -
Getting and modifying attribute text inside a dynamic block
p7q replied to p7q's topic in AutoLISP, Visual LISP & DCL
Thanks ı got the part of ı needed. - Last week
-
LISP to select lines and text according to "Z" values
Nikon replied to shokoufeh's topic in AutoLISP, Visual LISP & DCL
If all the primitives (TEXT,MTEXT,INSERT,LINE,LWP,Circle,Mleader,Dimension) are perceived as objects, then you can use this code: ;; Set coordinates of objects (TEXT,MTEXT,INSERT,LINE,LWP,Circle,Mleader,Dimension) Z in 0 (defun zeroz-in-list (lst /) (cond ;; The list of coordinates-vertex ((and (listp lst) (= (length lst) 2) (numberp (car lst)) (numberp (cadr lst))) ;; if only XY - expanding to XYZ (list (car lst) (cadr lst) 0.0) ) ((and (listp lst) (= (length lst) 3) (numberp (car lst)) (numberp (cadr lst)) (numberp (caddr lst))) ;; if already XYZ - just do Z=0.0 (list (car lst) (cadr lst) 0.0) ) ;; If it's a large list, it's probably nested ((listp lst) (mapcar 'zeroz-in-list lst) ) (t lst) ) ) (defun c:ObjZ0 (/ ss n e el newel) (prompt " Select objects (all types, including polylines, mleader, dimension): ") (if (setq ss (ssget)) (progn (setq n 0) (while (< n (sslength ss)) (setq e (ssname ss n) el (entget e) newel nil ) (foreach pair el (cond ;; height LWPOLYLINE (code 38) ((and (= (car pair) 38) (numberp (cdr pair))) (setq newel (cons (cons 38 0.0) newel)) ) ;;Point codes (for example, 10, 11, 12...), etc. ((and (numberp (car pair)) (not (= (car pair) 210))) ; Don't touch the normal (if (listp (cdr pair)) (setq newel (cons (cons (car pair) (zeroz-in-list (cdr pair))) newel)) (setq newel (cons pair newel)) ) ) ;; The rest (t (setq newel (cons pair newel))) ) ) ;; Restoring order and modifying the object (entmod (reverse newel)) (setq n (1+ n)) ) ) ) (princ) ) If the Z coordinate is not displayed in the properties (example, for dimensions, for Mleader), then you need to use the _LIST command. Don't think of me as a programmer... The code is written using AI. -
LISP to select lines and text according to "Z" values
Steven P replied to shokoufeh's topic in AutoLISP, Visual LISP & DCL
Use what you have done previously but for dx code 10: (foreach dxf le (if (= (car dxf) 10) (setq le (subst (cons 10 (zeroz (cdr dxf))) dxf le)) ) ) -
LISP to select lines and text according to "Z" values
shokoufeh replied to shokoufeh's topic in AutoLISP, Visual LISP & DCL
Oh OK. Thanks for mentioning -
LISP to select lines and text according to "Z" values
GLAVCVS replied to shokoufeh's topic in AutoLISP, Visual LISP & DCL
Yes I briefly forgot that LWPOLYLINES don't have a Z coordinate and instead use group 38 to define their elevation. Therefore @shokoufeh: the code you added to set the Z for LWPOLYLINES is unnecessary -
LISP to select lines and text according to "Z" values
shokoufeh replied to shokoufeh's topic in AutoLISP, Visual LISP & DCL
so, how should I change the code? -
LISP to select lines and text according to "Z" values
Steven P replied to shokoufeh's topic in AutoLISP, Visual LISP & DCL
Missed your message but am intrigued now... (a guess I would say you were saying LWPolyline has X, Y, Z coords - I've done the same many times too) -
LISP to select lines and text according to "Z" values
Steven P replied to shokoufeh's topic in AutoLISP, Visual LISP & DCL
I think hatch is the first '10' if an elevation has been set (10 0.0 0.0 'Z') -
LISP to select lines and text according to "Z" values
shokoufeh replied to shokoufeh's topic in AutoLISP, Visual LISP & DCL
I was checking my files and I found out another problem. Except elements I mentioned (lines, poly lines, texts and blocks), the problem with Z values exist in other elements, as I mention below: Hatch: Elevation Leader: Vertex Z Ellipse: Start Z, Center Z, End Z Arc: Start Z, Center Z, End Z Circle: Center Z Solid: Elevation Attribute Definition: Text Alignment Z Array (Rectangular) : Base Z Please check this modified lisp and see if it is correct or not. This lisp doesn't work on HATCH. ZRemove.lsp -
TEXT HEIGHT VALUE FOR ARCHITECHTURAL UNIT IN TEXT TAB OF DIMSTYLE MANAGER DILOG
oddssatisfy replied to LIU's topic in AutoCAD Beginners' Area
Enter 2.6 in the Text Height box. -
LISP to select lines and text according to "Z" values
GLAVCVS replied to shokoufeh's topic in AutoLISP, Visual LISP & DCL
Sorry: That problem will never exist in a LWPOLYLINE: Forget what I said, if you managed to read the previous message -
LISP to select lines and text according to "Z" values
GLAVCVS replied to shokoufeh's topic in AutoLISP, Visual LISP & DCL
Sorry: The problem I referred to will never exist in a LWPOLYLINE: Forget what I said, if you managed to read the previous message -
Steven P started following LISP to select lines and text according to "Z" values
-
LISP to select lines and text according to "Z" values
Steven P replied to shokoufeh's topic in AutoLISP, Visual LISP & DCL
There was a thread a few days ago about speeding up a LISP to do the same, have look at that for ideas. I think the thread got as far as arcs are tricky to do with LISPs. You could use the flatten command for small drawings. This snippet will filter a selection set to lines or LWPolylines to anything not 0 Z (setq MySS (ssget (list (cons 0 "*TEXT,INSERT,LINE,LWPOLYLINE") '(-4 . "<OR") '(-4 . "*,*,<>") (list 10 0.0 0.0 0.0) '(-4 . "*,*,<>") (list 11 0.0 0.0 0.0) '(-4 . "<>") (cons 38 0) '(-4 . "OR>") )) ; end list, end ssget ) Can be added to the other solutions herein the case that your drawing has a lot of lines / polylines / blocks it speeds it up a bit Link to other thread: -
LISP to select lines and text according to "Z" values
GLAVCVS replied to shokoufeh's topic in AutoLISP, Visual LISP & DCL
Sounds good If you've tried it and it works: -
LISP to select lines and text according to "Z" values
shokoufeh replied to shokoufeh's topic in AutoLISP, Visual LISP & DCL
GREAT. It works. Thank you very much