AutoCAD Visual LISP / AutoLISP :: Sum Of Attribute Values

Jul 29, 2005

Say I have a block that contains two attributes, one contains a value that is a number and another contains a value that is letters. I have many of these blocks placed in a drawing, could you create a lisp that would return the sum of the number value and return it to the command line along with the letter value. Something like this:

Sum--------Item
128 RP
389 TD1
2389 SP4

View 9 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Attribute Blocks - Change 1st Tag Values Automatically According To 2nd Values

Jul 18, 2013

I have an attribute blocks and this att block has two tag values , is there a simple code for to change 1st tag values automaticly according to  2nd values ?

for example :

1st tag (50x50) - 2nd tag ( 100 )    ==> 50x50-100

if i enter 201 valuse to 2nd tag then 1 st tag has to change as 100x100

if i enter 501 valuse to 2nd tag then 1 st tag has to change as 150x510

I attached a jpg file for explain much better

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Transfer Attribute Block Values To Another Attribute Blocks

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

AutoCAD Visual LISP / AutoLISP :: Sum Attribute Tag Values

Jul 17, 2013

Lisp or lisp code for sum attribute tag values and paste result to an another attribute block tag?

i attached jpg for explain to what i want to do .

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Adding Up Attribute Values

Oct 26, 2012

Any routine where I could keep picking on my exit arrow blocks (showing how many persons exiting from each space) one-by-one and the program would add up the numbers.  For example I pick on blocks with numbers of 2, 4 & 3 and I would get 9.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Retrieve (2) Attribute Values From One Block

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

AutoCAD Visual LISP / AutoLISP :: Get Attribute Values From Multiple Blocks With Same Name?

Mar 21, 2013

This time I'm wrestling with getting the values from multiple blocks. The blocks all have the same name but at least the attributes have names this time. Each block have exactly 4 attributes, like: att1 (a number representing chronological order), att2 (some data), att3 (the actual date as a string of when the data was added), att4 (some more data)

I need to get and store the attribute's values. I was hoping to make a selectionset of the blocks and step through using the chronological order number.

At this point I have tried several combinations of foreach and ssget "x" (list (cons 2 MYBLOCK)), but I keep getting errors that I'm sure are telling me that I'm not passing the correct information to the function for iterating through. I'm banging my head.

(DEFUN c:GFOR (/ ATTLST REVBLK CNT CNT1 BLK RBLK ATTVAL ATT REV#)
(SETQATTLST(LIST "R#" "INIT" "DATE" "DESC")REVBLK(ssget "x" (list (cons 0 "INSERT") (cons 2 "REVISION")))CNT0CNT10 )
(vlax-ldata-put "dict" "RevTotal" (BLKCNT "REVISIONS")) (FOREACH BLK REVBLK (SETQ RBLK (ssname BLK CNT1)) (setq ATTVAL (mapcar '(lambda (x) (vla-get-TextString x)) (vlax-invoke (vlax-ename->vla-object RBLK) 'GetAttributes))) (foreach ATT ATTLST (SETQ REV# (STRCAT "REVISION" (1+ CNT)))
(vlax-ldata-put "dict" REV# (member ATTVAL)) (setq CNT (1+ CNT)) ) (SETQ CNT1 (1+ CNT1)) ) (PRINC))

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Remove All Block Attribute Values

Jun 17, 2013

I need a lisp sub-function that can empty all attributes of a specified dynamic block. The idea being that the specified block contains data that changes often and in order to repopulate the block's attributes with new data to replace the old I wish to just blank out the old data first, because it's possible that the new data may not utilize as many attributes and all of the old data must be removed. 

The thing is the block I'm after is on several layouts, CTABs and they all need to be wiped clean.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Inserting Attribute Values Into MySQL

Jan 18, 2012

How to connect to MySQL database and insert data from a set of blocks containing attributes?

Something like:

block 1:

- x coordinate;
- y coordinate;
- handle;

block 2:

- x coordinate;
- y coordinate;
- handle;

block 3:

- x coordinate;
- y coordinate;
- handle;

I've just got the second part (retrieving info from the blocks), but when it comes to connect to the DB I'm completely lost.

For the DB I'm using XAMP for Windows, thus using localhost, user ('user123'), pass ('pass123') and table ('table123'). The table has ID (PriKey and AutoInc), px, py and hdl fields.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Export / Import Attribute Values And Its Color

Apr 24, 2012

There is a BLOCKA that I'd like to extract its attributes - Tag and Color - into an external format (excel).  There after, I'd like to import it into the drawing and based on its color attribute value, change the value to that color in the drawing.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Extracting Attribute Values And Assigning To Variables?

May 27, 2013

How can specific attribute values be extracted from a drawing and assigned to a variable in lisp. 

The existing title block is having attributes : Area, Sub area, Description, Drawing type. I want to extract this values and assign it to some variable which I have already listed and then it shall be assigned to some other attributes in the same drawing with Area1, Subarea1, Description1, Drawing type1... and so on.. Both the attributes shall be in the same drawing file.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Block Attribute Values In Paperspace Multiple Pages

Feb 25, 2013

I have several title blocks each in their own paperspace pages. Could have the attribute filled in, but more than likely only one page will have values filled in the attributes. I am looking for a VL method for finding which pages title block is filled in so that I can get those values and fill in the equivalent attributes for all of the other pages. Currently I am using a long set of :
 
(IF (setvar "ctab" "8.5x11") (IF(TBLSEARCH "BLOCK" "TB-8.5x11") (IF (/= "" (get-att "OWNER" "TB-8.5x11")) ; Function to read a named attribute(editblk "TB-8.5x11") ; Function to pull up the attdia(IF (setvar "ctab" "11x17") (IF (TBLSEARCH "BLOCK" "TB-11x17") (IF(/= "" (get-att "CUSTNMFIRST" "TB-11x17")) (progn ; At the last page ditch the [Code]..........

 The example is just a very simplified version of what I'm doing. I just need to find the information, if it exists in any page and store it for later. Afterward, I'll fill in each page's Title Block with the stored information.

I know that this can be done much more efficiently. As I am currently flipping through the pages too much action is occurring on the screen and it makes some people nervous. With VL I should be able to run the search quietly, but I would still like to (setvar "ctab" "to the page with the filled attribute value") after the LISP is finished storing values.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Extracting Attribute Values From Multiple Dwg Files To An Excel File

May 11, 2013

how to extract the attribute value of a  particular block in multiple drawings to an excel file.

Eg... there are nearly 800 drawings where I need to list down the description and Drawing number which is mentioned in the title block name "Title". The Drawing Number and the description is done in same attribute block. extract the data into an excel file or txt file. All the drawings are saved in one location.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Match Multiple Attribute Values From One Block To Another Block

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

AutoCAD Visual LISP / AutoLISP :: Convert Attribute Tag Into Attribute Value?

Dec 8, 2011

Background: Someone exploded an attribute block and copied it hundreds of times throughout a project, each time changing the Attribute Tag to match the Value they expected to appear in their drawing.  The drawing must be xrefed, so the attribute definitions do not appear.

(There is only 1 attribute in the block.) 

Proposed Solutions:

1:AutoLISP routine which copies Tag data from Attribute Definition into Value of Attribute Block:

Prompt-Select Attribute Definition

Copy Tag data

Prompt-Select Attribute Block

Paste data into Value

(Allow repeat to speed workflow)(*PREFERRED*)

2:AutoLISP routine which copies Tag data from Attribute Definition into Default Value and creates a new Block:

Prompt-Select Attribute Definition

Copy Tag data

Paste data into Default Value

Create New Block

(Select Multiple Objects)(Creates tons of new blocks which are messy)

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get Attribute Value

Jun 3, 2013

I am trying to find a lisp that would get an attribute value (tag name = NBR_5) . I'm trying to run a simple routine that would let the user place the value from the titleblock attribute as text on a drawing. I see a ton of articles regarding getting attributes but I am not well versed in programming.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get The Value Of Attribute

Dec 30, 2011

Is there a quick way of getting the value of an attribute?

I have an attributed block called "tp_attributes" and it has and attribute called "OrderNum".

I just want to be able to quickly grab that value.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Check Block Attribute Then Change Different Attribute In Block

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

AutoCAD Visual LISP / AutoLISP :: How To Get Attribute Value From Block

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

AutoCAD Visual LISP / AutoLISP :: Copy One Attribute Value?

Nov 2, 2012

i want to select a block and the lisp copies TAG1 into my clipboard (i want to paste it in excel)

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Fix A Block Attribute

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

AutoCAD Visual LISP / AutoLISP :: Select All 3D Polylines With Same Vertex Z Values

Jun 17, 2012

I need to wright a routine in autolisp that selects all 3Dpolylines with the same vertex Z value.Qselect as no transparent mode and filter doesn't work.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Extract Values X Y Z From Vlax-3D-point

Jan 3, 2012

how to extract value X Y Z of point p3 p4

(defun c:test ()
  (vl-load-com)
  (setq actdoc (vla-get-ActiveDocument (vlax-get-acad-object)))
  (setq objm (vla-get-ModelSpace actdoc))
  (setq obju (vla-get-Utility actdoc))
(setq oldhigh (getvar "Highlight") oldsnap (getvar "Osmode") oldblip (getvar "BlipMode") oldecho (getvar "Cmdecho") );setq
(setvar "Highlight" 0) (setvar "Osmode" 517) (setvar "Cmdecho" 0)  (setvar "Blipmode" 0)

[code]....

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Deleting Text That Is 10 Values Long / Less

Dec 16, 2011

I often have DXF files that contain very many short (10 digits or less) instances of text, and only a few long instances of text (11 digits or more)....

I would like to use AutoLISP to delete all of the short text in my DXF file, but leave the longer text. 

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Looping Through Attributes And Store Values?

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

AutoCAD Visual LISP / AutoLISP :: Getting Routine That Will Sum Selected Text Values?

Jun 2, 2004

lisp routine that will add together the values of text entities? For instance, if I have a big parking lot and each section is labeled with the number of spaces, I could pick the texts and it would add all the numbers together to give me a total. Right now I export to excel to do this. I have quite a few situations where this would be handy, not just for parking spaces, so I really just want a lisp that will add all my selected numbers.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Why Vla-FullName Returns Values In Lowercase

Jan 11, 2014

Would you tell me why [b]vla-FullName[/b] returns a path in LOWERCASE (except of "Program Files" and other special folders) ??

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Polyline Z Values Not Being Returned By Vla-get-coordinates

Sep 8, 2011

I have a 2 point LWPOLYLINE that has the following coordinates at its end point when I 'ID' the point.

Command: id
Specify point: end
of  X = 709369.3214     Y = 7153039.9690     Z = 269.2143

However if I use..

(vlax-safearray->list (vlax-variant-value (vla-get-coordinates (vlax-ename->vla-object (car (entsel))))))

I get this

(-450567.0 269.288 -450570.0 269.214)

and if I 'dump' the object..

;   Coordinates = (-450567.0 269.288 -450570.0 269.214)
;   Document (RO) = #<VLA-OBJECT IAcadDocument 09855674>
;   Elevation = 7.17399e+006

I don't have a clue where the '-450567.0' is coming from.

I'm in Model Space in 'World' UCS, and I'm confused..  why does the 'ID'd' value not reflect whats going on when I use the vla-get-coordinates approach.

There are many other LWPolylines within the same model that behave normally.

I've attached the drawing (I think!)

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create A Selection Set Of Y Values Of Text?

May 9, 2013

What I am trying to do is create a selection set of the "y" values of text.  I've started by pulling out all the text on the drawing, but I need it to continue to grab only the "y" values of the text on the drawing.

(setq alltext (ssget "_x"  (list '(0 . "TEXT")) 
)  
)     

I've tried a bunch of different things but I am still new to lisp.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Values Not Appearing In Command Line

Jul 23, 2013

I cannot determine what triggers this but the command line has stopped returning values from lisp expressions.

eg.  If I type (setq fred "Hello") I would expect to see "Hello" returned. I am getting nothing.  Similarly if I type !fred I get nothing.  If I restart AutoCAD the problem goes away.  The after some time it happens again. Is there a toggle or switch or system variable that I'm not aware of?

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert Block And Fill In Attributes With Var Values

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







Copyrights 2005-15 www.BigResource.com, All rights reserved