All Activity
- Past hour
-
Dynamic Block - Same Values in Each State?
ILoveMadoka replied to ILoveMadoka's topic in AutoCAD Drawing Management & Output
I have an idea but am about to leave for the long weekend.. Have an editable attribute for the Left and the Right and when you enter that data, it sets another value for each of the 4 states. They can have a separate "non editable" attributes. Each state would have two attributes but they are all set by editing a single attribute in the main block. Edit the data once, set 8 attribute values from that. Can't explain it very well. Once I figure out the logistics, I'll ask for some help in the lisp section..- 5 replies
-
- attributes
- dynamic block
-
(and 2 more)
Tagged with:
-
Dynamic Block - Same Values in Each State?
ILoveMadoka replied to ILoveMadoka's topic in AutoCAD Drawing Management & Output
I'm looking... Hard to follow indeed... hate videos with no audio... <thx!>- 5 replies
-
- attributes
- dynamic block
-
(and 2 more)
Tagged with:
- Today
-
Dynamic Block - Same Values in Each State?
CyberAngel replied to ILoveMadoka's topic in AutoCAD Drawing Management & Output
Have a look at the video linked on this page. I can't quite follow it, but could you create an invisible attribute and echo it to the four positions?- 5 replies
-
- attributes
- dynamic block
-
(and 2 more)
Tagged with:
-
Dynamic Block - Same Values in Each State?
ILoveMadoka replied to ILoveMadoka's topic in AutoCAD Drawing Management & Output
This is indeed a Section Marker. Lisp is always welcome but I don't know where to start. Maybe the 8 attribute solution is the closest I can get... The Text Alignment is different in each of the views. Creating a field as part of the Insert would work but It would have to take into consideration how many similar fields were existing in the drawing then increment the value/name then reassign the new field to the new block. Beyond my novice skill set..- 5 replies
-
- attributes
- dynamic block
-
(and 2 more)
Tagged with:
-
Get length of MLeader/QLeader spline.
SLW210 replied to SLW210's topic in AutoLISP, Visual LISP & DCL
It would be nice if you could put the prompts and comments in English. I saw the Dogleglength when I did a dump on a Mleader. I'll see what I come up with. I know how to get a Spline length, I don't want to explode the Mleaders, defeats the purpose. -
The fix for the 1st and last arrow is easy, I look at the first point and is pline open if yes then just set angel_2 to the same ang as angel_1, Just add that extra line of code, same for last point, I just ignored and did not change. Same with your attributes how do you want to handle them so they are filled in correct.
-
Get length of MLeader/QLeader spline.
BIGAL replied to SLW210's topic in AutoLISP, Visual LISP & DCL
As a spline gives two answers the points answer and another with nodes. So any way if you explode the Mleader then you can get at the spline using this. Just need to check that the spline is last entity, tested in Bricscad. A disclaimer not sure if length is correct. I think it is short by length of arrow. Will try to find arrow length. Yep found it. (defun c:wow ( / plent pt len lenar) (setq plent (entsel "\nPick mleader ")) (setq lenar (cdr (assoc 140 (entget (car plent))))) (command "undo" "M") (command "explode" (car plent)) (setq ent (ssname (ssget "L") 0)) (setq len (getpropertyvalue ent "length")) (command "undo" "B") (alert (strcat "Total length is " (rtos (+ lenar len) 2 3))) (princ) ) (c:wow) I think you could do a "I want a length of 100 by drawing something close then move say arrow point till you get approx 100. Via lisp. It would be a two step process explode and move then undo and reset arrow head point. - Yesterday
-
Dynamic Block - Same Values in Each State?
BIGAL replied to ILoveMadoka's topic in AutoCAD Drawing Management & Output
This is very similar to the problem of draw a section marker, if your happy with a lisp answer can be done very easy, you have 4 choices or can be based on say 3 point pick. Would use say 2 blocks. a HOR and VER arrow. The other way may be to look at the angle the block is inserted and rotate the attribute about a centre justification, not sure if can do that in a dynamic block. will have a play. Some one else may jump in with a new dynamic block. Did something similar in another post that stretches the gap between the arrows.- 5 replies
-
- attributes
- dynamic block
-
(and 2 more)
Tagged with:
-
Worked perfect, the scale and the color thing is nice. Thank you very much, for you time and help.
-
I tested it it work perfect. Only thing that is a little bit difficult is selection but I think I can take care of it. Thank you very mach you help me solve my problem.
-
I tested it, its work fine. Only tune that needs is the take care of the first and the last. Both arrows has to point in one direction. Thank you very much for you time and effort.
-
Try an another version (vl-load-com) (defun c:BLOCKINSERT ( / ss blkname acadObj doc mspace n dxf_ent vlaobj pr nb_e scl_blk pt lst_pt nbs ang1 ang2 blk lst itm) (setq ss (ssget '((0 . "*POLYLINE") (-4 . "<NOT") (-4 . "&") (70 . 112) (-4 . "NOT>"))) blkname "Stalb" ) (cond ((and ss (tblsearch "BLOCK" blkname)) (setq acadObj (vlax-get-acad-object) doc (vla-get-activedocument acadObj) mspace (vla-get-modelspace doc) ) (if (null (tblsearch "LAYER" "EL_стълб_НН")) (vlax-put (vla-add (vla-get-layers doc) "EL_стълб_НН") 'color 1) ) (repeat (setq n (sslength ss)) (setq dxf_ent (entget (setq ent (ssname ss (setq n (1- n))))) dxf_210 (cdr (assoc 210 dxf_ent)) lst_pt nil) (setq vlaobj (vlax-ename->vla-object ent) pr -1 ) (repeat (setq nb_e (if (zerop (vlax-get vlaobj 'Closed)) (1+ (fix (vlax-curve-getEndParam vlaobj))) (fix (vlax-curve-getEndParam vlaobj)))) (if (not scl_blk) (progn (initget 6) (setq scl_blk (getreal "\nBlock scale?<1>: ")))) (if (not scl_blk) (setq scl_blk 1.0)) (setq pt (vlax-curve-GetPointAtParam vlaobj (setq pr (1+ pr))) lst_pt (cons pt lst_pt) ) (setq nbs (1- (length lst_pt))) ) (foreach pto lst_pt (if (and (not (zerop nbs)) (not (eq (1+ nbs) (length lst_pt)))) (setq ang1 (angle '(0.0 0.0 0.0) (vlax-curve-getFirstDeriv vlaobj nbs)) ang2 (+ pi (angle '(0.0 0.0 0.0) (vlax-curve-getFirstDeriv vlaobj (1- nbs)))) ) (setq ang1 (if (not (zerop nbs)) (+ pi (angle '(0.0 0.0 0.0) (vlax-curve-getFirstDeriv vlaobj (1- nbs)))) (angle '(0.0 0.0 0.0) (vlax-curve-getFirstDeriv vlaobj nbs)) ) ang2 ang1 ) ) (if (and (zerop nbs) (not (zerop (vlax-get vlaobj 'Closed)))) (setq ang1 (angle '(0.0 0.0 0.0) (vlax-curve-getFirstDeriv vlaobj nbs)) ang2 (+ pi (angle '(0.0 0.0 0.0) (vlax-curve-getFirstDeriv vlaobj (length lst_pt)))) ) ) (if (and (eq (1+ nbs) (length lst_pt)) (not (zerop (vlax-get vlaobj 'Closed)))) (setq ang1 (angle '(0.0 0.0 0.0) (vlax-curve-getFirstDeriv vlaobj nbs)) ) ) (setq nbs (1- nbs) blk (vla-InsertBlock mspace (vlax-3d-point pto) blkname scl_blk scl_blk scl_blk 0.0) ) (vlax-put blk 'Layer "EL_стълб_НН") (vlax-put blk 'Color 3) (setq lst (list (cons "Angel_1" ang1) (cons "Angel_2" ang2))) (foreach x (vlax-invoke blk 'getdynamicblockproperties) (if (setq itm (assoc (vla-get-propertyname x) lst)) (vla-put-value x (vlax-make-variant (cdr itm) (vlax-variant-type (vla-get-value x)))) ) ) ) ) ) ) (prin1) )
-
1958 started following Get length of MLeader/QLeader spline.
-
ml.LSP
-
Anyone have any hints on how to get Spline Leader lengths? Ultimately, I am looking to make several already drawn spline leaders the same length.
-
ILoveMadoka started following Dynamic Block - Same Values in Each State?
-
Dynamic Block - Same Values in Each State?
ILoveMadoka posted a topic in AutoCAD Drawing Management & Output
I want to create a dynamic block with 4 visual states. I want two text values to appear in each state but in different places in each state. If I understand correctly you cannot move an attribute from state to state. Fields would work but I have no way of knowing how many of these blocks may be needed in a particular drawing. If I copy the attributes from VS to VS when creating the block, they only are available in the first state. The other states report there is no editable attributes but if I edit the state they are there. Here is a diagram of the 4 visual states. (the red is not part of the block, just a separator) I had created a block with 8 attributes but users found it confusing or difficult to navigate. Is there a way to achieve this in a simpler/better fashion?- 5 replies
-
- attributes
- dynamic block
-
(and 2 more)
Tagged with:
-
mhupp started following Getting and modifying attribute text inside a dynamic block
-
Getting and modifying attribute text inside a dynamic block
mhupp replied to p7q's topic in AutoLISP, Visual LISP & DCL
try using nentsel (nested entity select) Tho you will have to select the attribute itself and not just the block. might want to add some error handling like check for attribute or text. then after you edit will have to regen to update the drawing. (defun c:foo () (while (setq sel (nentsel "\nSelect Block Attribute : ") (setq ename (car sel)) ;check if sel is attribute (setq edata (entget ename)) (setq tag (cdr (assoc 2 edata))) ; Attribute tag (setq val (cdr (assoc 1 edata))) ; Attribute value (princ (strcat "\nTag: " tag ", Value: " val)) ) (princ) ) -
Saxlle started following Sorting by Y-coordinate from bottom to top and Getting and modifying attribute text inside a dynamic block
-
Getting and modifying attribute text inside a dynamic block
Saxlle replied to p7q's topic in AutoLISP, Visual LISP & DCL
Hi @p7q, You can try with this several options from image below. From the last lines of code, you will get something like this. Try to play with this. Also, you can get from Lee Mac website about Attribute Functions. Best regards. -
Performance helps for Large-Scale Z-Flattening (Z0) AutoLISP Routine?
Danielm103 replied to p7q's topic in AutoLISP, Visual LISP & DCL
LOL! Only for items that look difficult, or painful in lisp, where there’s a possible built in function. This drawing took 0.03673760 seconds to process. if the drawing is indeed correct, have a look here for how to run python https://github.com/CEXT-Dan/PyRx arc2.dwg -
Sorting by Y-coordinate from bottom to top
Nikon replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Thanks, I replaced cadr with caddr, everything is fine. -
Performance helps for Large-Scale Z-Flattening (Z0) AutoLISP Routine?
Isaac26a replied to p7q's topic in AutoLISP, Visual LISP & DCL
That sounds to me that you are trying to pull us to the dark side, sounds pretty tempting, would you walk us through? -
Sorting by Y-coordinate from bottom to top
Saxlle replied to Nikon's topic in AutoLISP, Visual LISP & DCL
-
Performance helps for Large-Scale Z-Flattening (Z0) AutoLISP Routine?
p7q replied to p7q's topic in AutoLISP, Visual LISP & DCL
sorry ı dont know how to use this code in acad. I'm trying -
Sorting by Y-coordinate from bottom to top
GLAVCVS replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Is the coordinate order set to Y, X, Z? This could be the error. Try changing cadr to caddr in the line '(setq yval (cadr (assoc 10 edata)))' -
Performance helps for Large-Scale Z-Flattening (Z0) AutoLISP Routine?
Danielm103 replied to p7q's topic in AutoLISP, Visual LISP & DCL
Did you have a look at my drawing? Python converted those arcs to ellipses in milliseconds. If you can run python, then it would be pretty easy to make it callable from lisp -
p7q started following Getting and modifying attribute text inside a dynamic block
-
Getting and modifying attribute text inside a dynamic block
p7q posted a topic in AutoLISP, Visual LISP & DCL
Hi everyone, I’m trying to get the text from an Attribute Definition (ATTDEF) inside a dynamic block using AutoLISP, and then change that text. Unfortunately, I haven’t been able to make it work. Here is what I tried: (defun getblockentities (blk / ent enx rtn) (if (setq ent (tblobjname "block" blk)) (while (setq ent (entnext ent)) (setq enx (entget ent)) (if (= "INSERT" (cdr (assoc 0 enx))) (getblockentities (cdr (assoc 2 enx))) (progn (setq text (vlax-ename->vla-object ent)) (if (car text) (setq tlist (append tlist (list text))) ) ) ) ) ) ) And then I tried to collect attributes like this: (setq attlist (vlax-invoke textObj 'GetAttributes)) (foreach att attlist (if (not (eq (vla-get-tagstring att) nil)) (progn (setq text (vla-get-tagstring att)) (setq tlist (append tlist (list text))) ) ) ) But with this approach I couldn’t retrieve the attribute text. Is there another method to get (and later modify) the text string of an attribute inside a dynamic block? Thanks in advance for any guidance. edit: ı'm adding to dwg for trydinamic block text.dwg