AutoCAD Visual LISP / AutoLISP :: Change A Specific Attribute From Specific Block To Specific Value
Dec 7, 2011
I've had a simple lisp I've been using for years that suddenly disappeared. It required that you identify a block name, tag name, and the value that you want the tag to be. All of this is performed via command line, so it is scriptable. Since I lost it, I've been experimenting with -attedit. This command comes frustratingly close to what I'm looking for, except it only appends an existing tag, or replaces a specific string within the tag; I can't get it to replace the entire tag, regardless of its value.
1> Any lisp routine that does what I describe?
or
2> How to make -attedit replace a tag value without regard to what the value currently is (like a * wildcard)?
View 9 Replies
ADVERTISEMENT
Aug 30, 2011
How would one modify
(= (cdr (assoc 0 data)) "ATTRIB")
in order to filter for a certain attribute tag named MYTAG
I am working with a custom LISP routine which reports out to a CSV file, an attribute extraction file - but I need my routine to ONLY evaluate blocks which have the MYTAG attribute tag. Then, if it passes that first check, it evaluates another list of Tags within those blocks - a list of tags which I have specified elsewhere in the code.
I am trying to modify my existing code as little as possible, and I think that if I do it at the line (which I've pasted above) - that will "pre-qualify" my selection set....
ATTACHED LISP IS THE FILE I AM WORKING WITH --- THE ACTUAL LINE I WANT TO MODIFY IS AT:
"(while (eq ENSUB "ATTRIB")"
View 3 Replies
View Related
Nov 11, 2011
I currently have a LISP routine that will replace the value of a specific attribute name with sequential numbers in the order that the blocks are selected. Like TCOUNT for attributes - and it only looks for a specific attribute Tag Name called "ID".
However, what I want it to do now, instead of just putting the number into the attribute value, I want the number to be a suffix to the existing default tag value of the tag named "ID" which is "ADDRESS:" for some blocks and "ELEVATION:" for other blocks but the tag name that the routine always has to filter for is "ID". That way the user can pick anywhere on the block - not being forced to pick the tag we want to add numbers to.
What I need the new LISP to do is append a space and then a number to the existing tag value in the block, so that the result would look like "ADDRESS: 1", "ADDRESS: 2", "ADDRESS 3" or "ELEVATION: 1", ELEVATION: 2", etc. depending on whatever the default value for the tag "ID" is.
there are several hundred different block names - but they all have a Tag Name of "ID" - whose default value is sometimes "ADDRESS:" and sometimes "ELEVATION:".
View 8 Replies
View Related
Jan 6, 2014
Convert Fields to text in my Title Block. I want to change some specific attributes only to convert into texts in my title block ( "MODE_A3" is my Title Block name).
For example in "MODE_A3" block having lots of tags like TAG1, TAG2, TAG3 upto TAG10 with fields. I need to change TAG3, TAG4, & TAG5 attribute fields into texts in all layouts.
View 6 Replies
View Related
Feb 13, 2013
I need to delete a specific block from current opened drawing by LISP command.
for example removing XREF attached is very easy:
(COMMAND "-XREF" "D" "FRAME")
I can remove "FRAME" XREF from drawing. Now, I want to delete a/all block with "TB12" name with same action!
(command "BlockDelete" "TB12")
so, how can I delete a/all block with specific name in current drawing?
View 9 Replies
View Related
Jan 28, 2012
I would like to insert a block in a specific layout (eg. "LAYOUT13") using the function vla-insertblock
I have already searched the web and this newsgroup but have not found the solution.
View 3 Replies
View Related
Sep 19, 2011
If you do a LIST command on a dynamic block... AutoCAD tells you the Block Name as well as the Anonymous Block name.
How can I use ssget to snag all Dynamic Blocks that use the 'Real Block'?
View 3 Replies
View Related
Sep 20, 2013
I have some code that starts a new drawing with a specific template from a lisp routine
(defun ghd:load_newdwg (template / ae-acad-object newdwg)
(setq ae-acad-object (vlax-get-acad-object))
(setq newdwg (vla-add (vla-get-documents ae-acad-object) template))
(vla-put-activedocument ae-acad-object newdwg)
)
The template location and file is stored in variable clienttemplate (and is not the standard template path set under options). All works okay except if I close the new drawing, when I return to the previous drawing that was current when the new drawing was created (i.e. the drawing that the routine was run from). I get the following error:
Command: ; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Unknown exception occurred
; warning: unwind skipped on unknown exception
I assume this has something to do with the original routine not closing/finishing before switching to the new drawing. This is the last line of the routine:
(cond ((= startnewdwg 1) (ghd:load_newdwg clienttemplate)))
View 3 Replies
View Related
Oct 3, 2013
I need a lisp which is i can draw a line or pline with circle in every 30 meters ( circle diameter and total line or pline length will be optional )
View 6 Replies
View Related
Apr 9, 2013
I have a lisp which I use to erase all points in a specific layer.
(defun cPL ()
(setq ss1 (ssget "x" (list '(0 . "point")'(8 . "Points"))))
(command ".erase" ss1 "")
(princ)
)
It is working only if I have the points in the DWG. If there are no points, I receive "Unknow command DPL". Is there anything I can do in order to avoid this error?
View 5 Replies
View Related
Mar 1, 2012
how to quick select all the blocks from a specific layer (for instance XPTO) and export them along with their attributes, exactly as we do by quick selecting them and then, through AutoCAD Express -> Attribute Export Info, but in a script...
View 9 Replies
View Related
Apr 25, 2013
I'd like to run one command that allows the user to draw a polygon viewport then sets that VP to 1/8"=1'-0".
It can be nearly accomplished with a macro, but falls just short because the polygon vp requires an unknown number of clicks, so there is no way to know how many pauses for user input in the macro.
View 6 Replies
View Related
Nov 28, 2012
Is there a LISP code for disabling OSNAP for specific objects or layers? An automatic disable for multileaders would be useful when fine tuning the text placement. Trouble is you need the snap for the leader end. Maybe you could disable the snap for the text grip only.
View 1 Replies
View Related
Mar 18, 2008
I need to draw an ellipse at a specific point on a drawing.
i can calc the major and minor and i have a polar point of where it should be drawn.
i just need the code to draw the ellipse.
View 4 Replies
View Related
Apr 5, 2013
I'm looking for a way to find out what all plot styles are set in drawings in a sheet set.
We are transitioning from color based pen settings to style based and would like to be able to export a log that shows the variable PSTYLEMODE for each drawing in a sheet set. I plan on using ScriptPro to run it on the full sheet set.
Civil 3D 2013
Windows 7 64-bit
Xeon W3550 3.07 GHz
Nvidia Quadro 4000
12.0 GB RAM
View 2 Replies
View Related
Aug 25, 2005
I need a LISP routine that could delete specific blocks from drawings. I have over 100 drawings, each having 4 blocks that I need to get rid of.
View 9 Replies
View Related
Jan 9, 2014
I have double line pipe drawings but i have to change distances between of this lines in entire drawing and i was thinking that maybe there is a lisp code which can create new double line according to my specify dimensions ...
example :
Distance between lines : 100 mm
------------------------
------------------------
here is what i want to do :
1. select double line
2. specify new distance ( for example 200 mm)
3. lisp will create center line middle of the selected lines ( maybe it can ask me that this center line will be permanently or not )
4. lisp will create new double line from this centerline according to my specific distance
5. new double line layers will be the same with selected old double line
and this lisp has to work for double arc or quarter circles too.
View 7 Replies
View Related
Jun 14, 2013
I am looking for an alternative to in place XRef Edit.
The third party software I am stuck with has disabled in place editing an Xref.
The specific application I need is to allow the user to move an intelligent room tag that is XReffed into discipline specific models. Disciplines are Architectural, Mechanical, Electrical..Etc. Each discipline has their own room tag and needs to move their own tag to a location that can be clearly seen on their finished plot. Xref edit in place is the perfect tool for this..But since the third party has disabled the command, I need an alternative method.
View 9 Replies
View Related
Aug 31, 2012
select all blocks on certain layers in a drawing, check attribute CIRCUIT in each block if it starts with MS then attribute CONTROL = switched. I hope thats clear enough the way
(defun c:control()
(graphscr)
(Setq sc (ssget "X" '((0 . "INSERT")
[Code].....
View 1 Replies
View Related
Nov 27, 2013
Im using Autocad Structural Detailing 2013. Its is possible to make specific command to start at specific layers?
EX: Breakline ,by default start at "LAYER 88".
Polyline ,by default start at "LAYER 150".
View 2 Replies
View Related
Sep 26, 2012
What I want to know is if there is a way to make a hotkey or at all save specific options for specific tools. Let's say I'm using the 'Paintbrush, Opacity 70%, Hardness 075, Size 4.00' as my "standard outline tool". Can I some how save that preference (and any other tool such as "Specific Eraser Op. 100%, Hard. 100, Size 10.00) so that I can easily switch between "Ouline Brush" and "Specific Eraser" . Maybe to the 'f-buttons'
I'd like to be able to make maybe 5 specific tools:-Outline Brush
-Small Eraser
-Big Eraser
-Detailed Color brush
-Big Color Brush.
View 4 Replies
View Related
Oct 11, 2011
What I am trying to do is grab the value of the owner tag (of which there are four), and use that value to determine which layer to place it on. What it seems to be doing is hanging.
Here is what I have so far:
(setq SSBlks (ssget "x"'((0 . "*INSERT"))))
(while (/= (sslength SSBlks) 0)
(setq w(sslength SSBlks) V 0)
(setq attentity (ssname SSBlks 0))
(setq attname (entget attentity))
(setq cntr 0)
(while (< V cntr)
[Code] ......
View 9 Replies
View Related
Jul 3, 2012
I wanna transfer my attribute block values to another attribute text blocks , is there any lisp for that?
Is there a possibility for sum tag values of choice attribute blocks to inside of another attribute text block ?
View 2 Replies
View Related
Feb 12, 2012
I need to match few attribute values from one block to different block. I download a lisp file called; ca.lsp which can match the single attribute value. I modified it for more than one attribute value matching. It is ok but still wish to overcome two issues for batch prcess
1. picking up the blocks by selection
2. click the alternative block numbers of times to match the numbers of attribute values I needed.
How to modify this lisp I can run it by block name selections instead of picking selection which enable me to run batch process for numbers of drawing? That will be good...
Lisp & Demo file attached (Match attribute value, A, B & C to Attribute 1, 2 & 3).
View 3 Replies
View Related
Jun 17, 2013
I continue with my problems.....
I get attribute value from block and put it in a list:
(repeat (setq cnt (sslength sset))
(setq attValue (GetAttributeValue (ssname sset i) "tag1"))
(setq attValue2 (GetAttributeValue (ssname sset i) "tag2"))
[Code]...
When I try to put them in a table...
(foreach item lst
(vla-setText mytable
row 0
(last item)
)
(setq row (1+ row))
)
only put one ( attValue2) at column, and i like put 2 values, each one in a column in the same row
View 9 Replies
View Related
Mar 29, 2012
I need fix a block attribute named "NrPunct.dwg"
MyProblem: after I insert the block “NrPunct” in my drawing ,, I cannot modify "textHeight", when I edit the ATTDEF (or attribute) with the command “DDEDIT” . Why?
You see my arrow in the picture pozamea.jpg…
View 2 Replies
View Related
Jul 16, 2013
I am trying to update my Title Block with a LISP routine (As the title implies).
So far, this is what i have...
(defun c:aTest (/ ss att)
(if (setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 "TB_PARAMOUNT_ELC")
(cons 66 1)(if (getvar "CTAB")(cons 410 (getvar "CTAB"))
(cons 67 (- 1 (getvar "TILEMODE")))))))
(progn
(foreach ent (mapcar 'cadr (ssnamex ss))
(setq att (entnext ent))
[Code]...
The title block, block name is static. The attribute name is static.
My ultimate goal is to copy the value of one attribute and "paste" that into the value of another attribute, and itterate this through the entire project.
View 9 Replies
View Related
Feb 3, 2012
I'm looking for a lisp routine that will globally list all the values from a specific attribute tag within a specific block. The attribute tag is "COMMENT" and the block name is "FSD".
View 9 Replies
View Related
Jun 24, 2013
I can't find my notes on how I fixed it. When we insert our title block, it automatically inserts the drawing number. For one user, it doesn't work. The title block inserts, but it won't put in the drawing number. I seem to remember I need to change a setting or something to get it to work, but I can't remember what it is.
View 3 Replies
View Related
Apr 15, 2013
I started a lisp that moves blocks according to their attributes and align numeric value in x 0.0. I work currently selected point by point. I will wish it to run at once on a selection set (I am angry with entsel).
(defun c:test (/ sel ent st newpt)
(if (setq eset(ssget))
(progn
[Code]....
View 9 Replies
View Related
Aug 24, 2011
Here's my situation:
I have a block named "WIDGET-A". And in that block are (4) attribute tags whose names are:
"ID"
"TAG01"
"TAG02"
"TAG03"
The user will be prompted to pick the value displayed at any of the "TAG##" attributes - they will select the attribute tag they want (we don't know which one it is, we just want to assign that value of the attribute tag they clicked on to a variable called "VAR2".
Now, what we also want AutoCAD to evaluate, behind the scenes, is the value of the attribute tag named "ID" which we know always exists in the block and then assign that value to a variable called "VAR1".
Is there a way for AutoCAD to do this all from only a single user pick on top of an attribute value, in a block whose name isn't always going to be 'WIDGET-A' either.... But the block, whatever it's name, will always have the attribute tag "ID" with a value in it, and we always want to capture the value of whatever attribute tag within the block that the user clicked on.
View 2 Replies
View Related