AutoCAD Visual LISP / AutoLISP :: Window Selection Of Attributes
Oct 16, 2012
I downloaded a lisp routine that will align block attributes. The problem is I can only select the attributes one at a time. I'd like to be able select multiple attributes using the selection window or a crossing window, but I haven't had much luck. If you use the AEATTSHOW command, it give you a prompt to "select using window" by pressing W. I'd like to have the same functionality for my Align attributes routine.
Below is the portion of code I currently have to select attributes one at a time:
;* Select all attributes to align with the parent selected above and add the attribute entname and the block
;* entname to a list in format ( (AttrEntName BlkEntName) (AttrEntName BlkEntName) (AttrEntName BlkEntName) )
;*
while (/= TempAttr nil)
(setq
TempAttr (nentsel "
Select Attributes to align: ")
[Code] .........
View 5 Replies
ADVERTISEMENT
Jul 11, 2012
It's possible make a fillet with window selection?
View 4 Replies
View Related
Jul 30, 2013
When you select similar using autocad it select similar in entire drawing. What i want is i am able to select similar using the same setting of selecting similar but with window selection instead of entire drawing ?
View 6 Replies
View Related
Nov 18, 2011
I have this snippet that inserts a block “Exit_Arrow”. The block has one attribute. Is it possible to force the attribute to remain at “0” rotation regardless what angle the bock is rotated?
(defun C:Exit_Arrow (/ LA DS)
(setq LA (getvar "clayer"))
(setq DS (getvar "dimscale"))
(C:TTEXT)
(command "._insert" " Exit_Arrow " pause DS "")
(setvar "clayer" LA)
(princ))
Is it possible to create blocks whose attributes remain at "0" rotation regardless the host block's rotation?
View 9 Replies
View Related
May 16, 2013
I isolated 3 attributes as you can see with my code. My object is too take the value of blkDESC1 and set it as blktag, and then take blkDESC2 and set it as blkDESC1, and erase blkDESC2.
(defun c:aup (/ dxf ent dxf1 ent1) (defun dxf (code ent) (cdr (assoc code (entget ent))))
(progn (if (and (setq ent (car (entsel "
Select an Attributed Block: ")))
(eq "INSERT" (dxf 0 ent))
[code]........
View 1 Replies
View Related
Nov 15, 2013
I've created a lisp that draws the boltholes of a pipe flanges, using the correct number of holes, at the correct diameter at the correct bolt-hole diameter and then rotates. Everything works seamlessly, when i do just one flange. But I've discovered that fewuently there will be mulitple times when a user will have to perform the command.
So the idea I had was to do the following:
Select all circles with (setq CirclesFirst (ssget "X" (list (cons 0 "CIRCLE"))))
Go through the code to create the new circles.
Select all circles with (setq Circles (ssget "X" (list (cons 0 "CIRCLE"))))
Remove selection set "CirclesFirst" from "Circles".
But what for some reason (command "_.select" Circles "R" CirclesFirst "") does not work.
View 9 Replies
View Related
Aug 6, 2013
I have a block named "WD_MLRH". There are 3 specific attributes which I want to change in it. The attribute names are.
RUNGCNT, RUNGDIST and RUNGFIRST.
RUNGCNT will = 20
RUNGDIST will = 1.0 (or 1 will suffice)
RUNGFIRST will be decided by a user input.
Something along the lines of...
(setq RUNGFIRST (getint "Enter first rung number: "))
I'm sure this is completely wrong, but i hope that portray what I'm trying to accomplish.
View 9 Replies
View Related
Jan 5, 2012
I've been trying tons of different solutions to solve this problem: insert a block that has an attribute which happens to be the last object id.
This is the best code I tried so far but without any succss.
(defun c:q1()
(command "_.PLINE")
(while (= (getvar "CMDNAMES") "PLINE")
(command pause)
[Code] .....
View 9 Replies
View Related
Sep 12, 2013
I have searched the web and the Autodesk Discussion Group for a LISP Routine that allows me to convert all attributes in a drawing to Layer 0 but i have had no luck. It would be great if the LISP could edit xrefs as well although not sure if this is possible.
**BATTMAN command will take too long for the hundreds of blocks, xrefs and drawings i need to edit.
View 2 Replies
View Related
Mar 1, 2013
I need a function that will allow me to do a "divide" with blocks but I need the single attribute to remain intact.
I need the blocks to align with object and keep the attribute. I did get it to work with constants but the function that I need to run next failed because of the constant. My variable is preset and locked.
View 9 Replies
View Related
Oct 11, 2011
I have to go through quite a few drawings and extract the attribute vales of the whole drawing and then a subset contained within a couple of polylines.
The whole drawing is Ok as I can use at out or the data extraction, but its the ones contained within a polyline. How do I do that?
View 9 Replies
View Related
Nov 3, 2013
How I can modify this code to create a block, ask for a new name for the block, then add the attributes listed inside the code below to the new created block. The lisp does a wonderful job - however, it only works if you already have a block created. We are in the process of drawing components and making blocks one by one, so it makes sense to add the attributes automatically when the block is created. We currently have over 500 components to create as a block and set the attributes to each one by one.
Also I would like to know, If Fields can be used inside the lisp routine. That way we can always have access to the attributes from outside the block and change values for all the blocks at once.
(defun c:addattribs ( / blk def ) (while (not (or (= "" (setq blk (getstring t "
Name of block to update: "))) (tblsearch "BLOCK" blk) ) ) (princ (strcat "
Block "" blk "" not found.")) ) (if (/= "" blk) (progn (setq def (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) blk)) (vla-addattribute def (getvar 'textsize) acattributemodelockposition "New Attribute 1" (vlax-3D-point 0 0) "NEW_TAG1" "New Value 1" ) (vla-addattribute def (getvar 'textsize) acattributemodelockposition "New Attribute 2" (vlax-3D-point 0 (- (* 1.5 (getvar 'textsize)))) "NEW_TAG2" "New Value 2" ) (command "_.attsync" "_N" blk) ) ) (princ))(vl-load-com) (princ)
View 9 Replies
View Related
Aug 8, 2012
I know how to retrieve the entity information from the block, but can't figure out how to write the loop statement to loop, look for first attribute, assign to a variable, goto next attribute, assign to different variable, etc., etc...
In my research, most programs I've seen it execute the loop, assign to a variable, then print/put that data somewhere, loop again and utilize the same variable to print/put the next data somewhere.
I would like each attribute within a block to be assigned a separate variable.
View 7 Replies
View Related
Mar 19, 2013
I have an interesting challenge. I am tasked with updating old drawings. The only difficulty that I've run into with the old files are that the TitleBlocks are all done with all of the attributes are named "SPEC". There are 90 attributes. I'm really struggling with getting each attribute's value and then storing the value to a variable so that I can then put that value into a new TitleBlock. The old TB will be deleted to avoid future confusion in the file.
(To clearify, the old TitleBlock is in model space, while there are actually nine new TitleBlocks all in seperate paper space Layouts, and this program may have to run on hundreds of files.)
getting the values from the Old TB. I need them in order of first to last or last to first (either way will work since I have the variable names in a list that can be reversed if necessary.)
simple function to read through the block's attributes in order and store the attribute's value to a variable name in the seperate list (also in order)?
View 5 Replies
View Related
May 21, 2013
I am testing de new version of autocad 2014 and i have a problem with lisp.
when i use (command "_insert" "block1" pt1 "" "" "" obj1 ).
The block is inserted but without value. In the old version work.Some variable that has to change?
View 3 Replies
View Related
Oct 15, 2013
How i can filter attributes string value.
How i set the layer name is = attributes string value.
Example:
A attributes string value is R8 .all these string is set the layer name is same string value(R8).
View 1 Replies
View Related
May 9, 2013
I have 40 pages in one set of drawings and would like to rev-up the drawings. i will put same texts in same locations in the title blocks.
View 9 Replies
View Related
Sep 5, 2013
I'm using a blocklibrary, where I stored all my blocks, most of them have attributes.
Now I'd like to simplify my workflow and want to update the blocks that I inserted in a drawing trough LISP.
Is there a way to update all inserted blocks and attributes of the whole drawing a once? The idea is, that the LISP checks the whole blocklibrary and updates the inserted blocks that to not match with the once from the library.
View 9 Replies
View Related
Feb 27, 2013
We wanted to automatically fill a block's attributes from a selection in Excel. I have a piece of code that has the user select/pick a block to fill. What I want is for the selection to fill multiple blocks in an active drawing. Some of the blocks are the same - which means the same tags/attributes. I've included the code that allows the user to select the block and throws the Excel selection to certain attributes.change the code so that
1) I don't have to manually select blocks - it will find them.
2) One cell (from Excel) will go to multiple blocks - some are same block name.
3) An IF statement that if a certain cell isn't blank/nil
(pretend it would be (nth 21 vl) change DESC11 to XYZ and DESC12 to ABC. For Block namesake we'll call one, BLOCK1 (say it has 3 instances and gets different info in each case) BLOCK2 (say it has 2 instances, also gets different info) BLOCK 3 AND 4 both have an attribute - DESCAA1 that gets different info from Excel.
(defun C:AUTOFCM (/*error* adoc attribs blkobj enExcelapp Sel Sht Rng vl Wbk ) (defun *error* (msg)(if adoc (vla-endundomark adoc)) (if (and msg(vl-positionmsg '("console break""Function cancelled" "quit / exit abort") ))(princ msg)(princ "Error!") ) gc) (princ) ) (or adoc (setq adoc (vla-get-activedocument (vlax-get-acad-object))) ) (vla-startundomark adoc) (alert "Select a range of cells in Excel.") (setq ExcelApp (vl-catch-all-apply (function(lambda ()vlax-get-or-create-object "Excel.Application") )) ) ) (if (vl-catch-all-error-p(setq Wbk(vl-catch-all-
[code]....
View 1 Replies
View Related
Jan 4, 2012
i am trying to restrict users from modifying certain attributes in a block,i can create the blocks with some of the attributes on locked layers, but then autocad pops up an annoying alert box, is there a way to disable this? the other option i can think of is to redefine the commands *ddedit, *attedit, *ddatte,*attipedit,
View 5 Replies
View Related
Dec 5, 2011
Any way to customize the double-click of a block attribute to run the _ATTIPEDIT command on the targeted attribute? I know this can be achieved by holding Ctrl & then double clicking, but I am often using my hand else where on the keyboard, or even more often, when entering many values into attributes, I am using my left hand to keep my place on a sheet of paper as I scroll down it and enter in the values.
View 5 Replies
View Related
Nov 4, 2011
I am using 2008 and I have a dynamic block with attributes that I want to insert with the below program and have the attritute values filled in automatically. I have done this with other programs in the past and they worked great with literally no problems. They were not dynamic blocks may be the reason this does not work. Why the block will not fill in the attributes like it should. Occasionally in my testing I see a message about "units" when I am inserting the block but I have my insunits set to 0. I have attached one of the blocks I want to use. I am thinking either you cannot do this because it is a dynamic block or there is a new variable that won't let it work.
(setq upisosym "L:/AcadUtilsJack/Programs/InsertIsoSymbols/ELL90BW_Flip_01" isosym "rat")
(setq upod "3" upsch "sched" upmatl "matl" uprat "400")
I found these two new variables and turn them off or 0 thinking they might be the problem???
(setvar "INSUNITSDEFTARGET" 1)
(setvar "INSUNITSDEFSOURCE" 1)
(defun c:JD ()
(setvar "attdia" 0)
(setvar "attreq" 1)
[Code] .....
View 9 Replies
View Related
May 14, 2012
how to sensibly extract angular dimensions as attributes.
I can extract the attributes from a block containing angular dimensions, the attributes list angular dimensions as a field but don't actually list the number of degrees for the angular dimension.
It is the number of degrees that I am actually trying to obtain - but I cannot work out how to obtain the information
View 3 Replies
View Related
Jun 7, 2010
I have a “PART” block with attributes tags “PARTMARK” and “SHEAREDFROM” inserted 5 to 10 times in 10 to 50 drawings.
The “PARTMARK” value is always a unique number entered in autocad.The “SHEAREDFROM” value is calculated in Excel and exported to a “SHEARED.txt” file.
In each “PART” block I need to replace the “SHEAREDFROM” value based on the unique “PARTMARK” value, using a script that uses (or incorporates) the values from the “SHEARED.txt” file.
So far the only solution I’ve come up with is having a unique value for the “SHEAREDFROM” and –attedit to change the values in a script. However if the script doesn’t encounter a "K20-1S" in the first drawing it errors out and doesn’t proceed to the next. Below is an example of my rudimentary script.
(command "-attedit" "n" "n" "PART" "SHEAREDFROM" "K20-1S" "K20-1S" "8-60x192")
(command "-attedit" "n" "n" "PART" "SHEAREDFROM" "K20-2S" "K20-2S" "2-60x144")
(command "-attedit" "n" "n" "PART" "SHEAREDFROM" "K20-3S" "K20-3S" "2-60x132")
(command "-attedit" "n" "n" "PART" "SHEAREDFROM" "K20-4S" "K20-4S" "4-60x120")
(command "-attedit" "n" "n" "PART" "SHEAREDFROM" "K20-5S" "K20-5S" "0.7-60x120")
I’m assuming I need LISP to do this, but my LISP skills are limited. I think I would need a setq for each unique shearedfrom value (setq K20-1S (“8-60x192”))? Then somehow search each drawing for the unique shearedfrom value to replace.?
View 9 Replies
View Related
Aug 30, 2012
I want to entmake a block with a multiline attribute. Entmaking the block definition works fine, but what do I code for the Multiline Attribute? Should it be coded (0 . "MTEXT") instead of (0 . "ATTRIB")? I know (101 . "Embedded Object") does not work. What other codes need to be included?
View 2 Replies
View Related
Apr 4, 2013
I need a lisp code to burst all "blocks with text/attributes inside" in selected area. That means user should select an area (window selection) and lisp program should be find all blocks with TEXT or ATTRIB inside in selected area and then applys "BURST express tools" command to all these blocks in the selected area by user.
View 9 Replies
View Related
Jun 18, 2013
My problem: I need to extract attributes from CAD files and export the data into MySQL type databases in order to compare the CAD data with other database data. Ideally the task needs to be done with a routine script that processes large sets of CAD files and data.
I would like to know: Can this be done?Whats the best way to script this or code this with an API? Is there a way to run this script on a server machine without AutoCAD installed? (Not that I'm trying to avoid using AutoCAD in general, of course the program was used to create the files, it just seems silly to install it on a server for one task)Is this script relatiavely simple, or would it require large amounts of time and/or an expert?
View 1 Replies
View Related
Jan 8, 2013
There is a quick way to remove all attributes, including in nested blocks. Looking some lisp in the forum, I can't find one code for remove this elements completely.
View 9 Replies
View Related
Oct 30, 2005
When using the express tool Burst, Invisible attributes are now visible. How does one modify the routine so that the invisible attributes are deleted.
View 3 Replies
View Related
Sep 4, 2011
Any routine that will allow to draw a polyline through existing blocks, in the order the blocks should be numbered? Therefore when the sequence has been specified by the polyline then user to define the number system required, and the blocks are automatically numbered in the sequence of the polyine start to finish.
View 9 Replies
View Related
Oct 3, 2012
How to create a lisp to automatically export attributes from selected blocks to defined txt file without having to everytime confirm the file name, location and if the file shall be replaced?
Meaning is that I often export attributes to txt file for further use. It is always the same file (I just overwrite it always).
The way I do it now is selecting blocks, using ATTOUT command, then going to the desktop, selecting ATT.txt file and confirming that it is to be replaced.
Is there a way to make lisp or script that will just do all it in at once?
I found on forum such a lisp as below, but it exports all ablocks on drawing and it exports to txt file which is located in same place as drawing and with same name as drawing. Tried to modify it but without success:
(defun cut-att ()
(load "attout")
(setq fna (strcat (getvar "dwgprefix")
(acet-filename-path-remove (acet-filename-ext-remove (getvar "dwgname")))
".txt"
))
(setq ss (ssget "X" '((0 . "INSERT") (66 . 1))))
(bns_attout fna ss)
)
Same question for ATTIN - I use attin and always same file name from same location - how to automate it with one command?
View 9 Replies
View Related