AutoCAD Visual LISP / AutoLISP :: Changing Text In Attributed Block
Dec 21, 2012
I am trying to speed up some basic drafting of text revisions. In the P (plumbing) we call out the fixture units for a water pipe, along with the fixture units, the pipe size changes.
Is there any way to add numbers in an attributed block? (I have a lisp that works on text & mtext, but not attributes)
1.1. Example: Like if you have a block with two attributed text fields, the 1st field {x} is a number (fixture unit), and the 2nd field {y} is a number (pipe size). I would want it to only add the 1st text fields. [If possible then change the 2nd text field according to a changeable chart. (see #2)]
1.1.1. This is how the block looks like: x (y")
1.1.1.1. x could be any number from 0.5 – 10,000 (only using 1 decimal place, and only as needed)
1.1.1.2. y could be any number from the following list: ½, ¾, 1, 1¼, 1½, 2, 2½, 3, 3½, 4, 5, 6
Is there a way like in excel that you can set up a formula that will give a numerical result depending on other input? Like pipe size that change depending on the number of fixtures. There would need to be two different formula, one for hot and one for cold values (The value would be set at the beginning of the job; typically these values would not change later in the job). This could be separate text or if possible using the attributed block as described in #1.
2.1. Example: Like if you have a block with two attributed text fields, the 1st field {x} is a number (fixture unit), and the 2nd field {y} is a number (pipe size). I would want it to change the 2nd text fields according to the value in the 1st text field. If the value in {x} is 0.5 – 1.0, it would result in ½; 1.5 – 7.0 = ¾; 7.5 - 17 = 1; 17.5 – 36 = 1¼; ect.
2.2. In excel it would be =IF(x)<1,"1/2",IF(x)<7,"3/4”,IF(x)<17,"1",…{all #’s in between} …IF(x)>5000,"6")))))
View 9 Replies
ADVERTISEMENT
Sep 13, 2013
I'd like to set up a blockwith different attributes like Roomname, Floor, Area,...
Therefore I'd like to link a polyline of the drawing with the block and it shows me its area. I know how it works with fields, but not how to connect it when the field is within a block.
Is there a LISP for that?
View 4 Replies
View Related
Dec 27, 2011
I have been working on an AutoLISP routine which is intended to:
1) collect input from the user via a DCl dialog box
a) Create a List of the non-null "GROUP_CODE..." variable values collected from the dialog's settings
b) Create a List of the "ESN***#_Part" variable values collected from the dialog's settings (does the List elements' order need to be reversed after collecting them?)
2) Prompt the user to select an insertion point
3) Insert a Block named "ESN-CONTROL-WIRED" which has multiple attributes
a) Apply the first List element collected at step 1.a above to the attribute tag "INPUT_ADD" in the block
b) Apply the first List element collected at step 1.b above to the Attribute Tag "PART_NUMBER" in the block
4) Insert a second instance of the Block named "ESN-CONTROL-WIRED" below the first instance
a) Apply the second List element collected at step 1.a above to the attribute tag "INPUT_ADD" in the block
b) Apply the second List element collected at step 1.b above to the Attribute Tag "PART_NUMBER" in the block etc. .... keep inserting the block "ESN-CONTROL-WIRED" below the previous on until all the input from the dialog has been displayed in the attributes.
Notes:
The Dialog's pop-up lists are populated from external .TXT files which reside on our network (or alternate local C: drive folder if no network drive is found)
Inside the file "ESN_SENSORS_NUMBER.LSP", it is the function "ESN_APPLY_TAG" which I am struggling with how to write...
find inside the .ZIP file:
- (2) example screenshot .BMPs showing dialog box settings and what the resulting output in AutoCAD should look like
- (1) ESN_SENSORS_NUMBER.LSP
- (1) ESN_SENSORS_NUMBER.DCL
- (1) ESN_SENSORS_NUMBER.DWG with a sample output - and the definition of the block ESN-CONTROL-WIRED
- (1) ESN-OCC.txt which populates the PopUp List Boxes
- (1) ESN-DAYLT.txt which populates the PopUp List Boxes
- (1) ESN-IR.txt which populates the PopUp List Boxes
View 6 Replies
View Related
Aug 9, 2013
I am reasonably experienced in coding in VBA but cannot find any references as to how to achieve the above within VBA so am now turning to LISP to see if I can achieve it in that language.
Basically I want to be able to create multiple instances of an attributed block using an external source, e.g. a spreadsheet to provide data for the attributes.
I'm not even sure if this is possible.
I can find lots of references for extracting attribute date to a spreadsheet but I want to go the other way!
View 2 Replies
View Related
Feb 6, 2011
I have insert blocks in my dwg. It is the circle. While creating the block, i was just pick the point into the circle not exactly at the centre.
Now i want change the insertion point of the block at centre of the circle without moving the objects from the dwg.
Beacuse i had use block editor to change the insertion point. But after changing, all blocks were moved from the original position.
View 4 Replies
View Related
Sep 3, 2013
I have too many blocks with specific layers inside.
develope lisp can change all to layer 0 but keep color and linetype as it is.
I will use this as a part of script to change multiple block.
View 9 Replies
View Related
Apr 30, 2012
I only do programming when absolutely needed so it usually only happens every couple years. I wrote this routine to count nested blocks inside of dynamic blocks to count parking spaces. The routine worked fine but was relying on the ltscale to scale a block containing an attribute for the total number of spaces. I want to update the routine to use an annotative block so the scale doesn't have to be set. I changed my block containing the attribute but now when I run my routine, the attribute height gets changed each time the routine is run. The text just gets larger and larger. Here is the portion of the routine where the attribute info is gathered and updated with the new value for that attribute. If you need the entire routine, I can post it with a slight modification so it will work outside our network.
(defun updateattrib ()
(setq CNT 0) ; sets count to 0
(while (< CNT (sslength ss)) ; starts loop while CNT is less than the number of objects in the group
[Code].....
I am running this in Civil 3D 2010 but will want it to work in 2013 so if the solution will only work in 2013, that is fine with me.
View 3 Replies
View Related
Oct 15, 2012
I want to override the measurement in a dimension with a string of text using a LISP command.
E.g.. "select dimension"
type new text for dimension
replace dimension measurement with new text. I can get the entity and its values, buy not sure which value to change for the "text override".
BTW Acad 2012.
View 3 Replies
View Related
Aug 4, 2013
I have inside every text,Mtext contents different text style like Arial_1 , Arial_2.
How i can give all the contents inside one style ? the normal procedure i will enter inside text to enter editing mode and changing text format style one by one. I want it once.
I want to save my routing of entering every text to change its content text style.
(Notice:select all from outside without editing mode will not do the job)
View 2 Replies
View Related
Sep 28, 2013
What is the best way to change the color of two pieces of specific text in lisp? I want to change where it says (strcase ln6) & (strcase ln7) to the color of green. I tried it a couple of different ways but I'm having some trouble. First I am setting the current layer with a color of blue. I am then running the text command a couple of times. I want to run the mtext command a couple of times but I want the text to be green & I want the width factor to be .85
View 9 Replies
View Related
Nov 23, 2011
The following snippit of code is changeing the color of text in a cell of an AcadTable. It will set the color to an RGB value and works great. But what if the color is a normal color 1 through 255 from autocad's pen table. How would I set the cell text color?
(setq objColor (vla-getcellcontentcolor eVLAMT R C)) ;sets a Color Object, whatever that is
(vla-setrgb objColor RED GRN BLU) ;sets the new color of the Color Object
(vla-setcellcontentcolor eVLAMT R C objColor) ;sets that new color object to the cell
View 5 Replies
View Related
May 17, 2013
I wanna change my block name to attribute text value, any similar lisp code?
View 9 Replies
View Related
May 3, 2013
Looking for routine for converting text to attributes inside the block?
In my drawing I hv some attribute blocks having some Text in it. I need to change the Texts inside the blocks as Attribute Texts. I am attaching sample Blocks drawing..
View 9 Replies
View Related
May 9, 2013
How to export title block attribute text .. in a order from different layout .? file ext .xls or .txt i got a tool named Autocad Automation tool but it not work very well autocad have data extraction - its also came all text .. and not in order .. can we develop the any lisp for that ?.
View 4 Replies
View Related
Aug 23, 2011
how to make a toolbar button so that when i click it and select a few single text, it will automatically change the text base point to be at "MIDDLE CENTER"....
At the moment, i use to create a button with macro of " ^C^C_text;j;mc "....But the problem is whenever i use this button, i still need to type "MC" at the command prompt.. How to make it so that after i click the button, all i need to to is just select the text..
View 9 Replies
View Related
Jun 29, 2012
I am looking for a way to change the text style used by a table style with Visual LISP. So far I have been able to get the IAcadTableStyle object from the acad_tablestyle dictionary, but there is no property for text style. Is this even possible? Code and results are below.
(defun DumpTableStyles ()
(setq dict (vla-get-dictionaries (vla-get-activedocument(vlax-get-acad-object))))
(setq TableStyles (vla-item dict "acad_tablestyle"))
(vlax-for TableStyle TableStyles
(vlax-dump-object TableStyle)
)
)
[Code]....
View 3 Replies
View Related
Nov 16, 2012
i failed to find one which would change string of a text to other for all types of objects. I mean it was usually either only multitext, or only text, dimensions or attributes.creating one which would change in abt 200 drawings:
-001
-002
-003
to:
-00001
-00002
-00003
in attributes, text, multittext, leaders, multileaders, dimensions..... at the same moment?
It is meant to be used in ScriptPro (by loading lisp in script).
If not possible, then can also open each file and run the lisp in each of them - still would save lot of time.
View 4 Replies
View Related
Oct 3, 2013
I get an AutoCAD drawing from my conveyor manufacturer who have buried a block (tagname) in all of their conveyor blocks.
The only way to remove them is to manually use BEDIT and erase the tagname block.
Is there a way through Autolisp to search all blocks in a drawings and if the tagname block is part of the definition of the conveyor block, erase the tagname block or redefine the conveyor block without the tagname block.
View 8 Replies
View Related
Mar 8, 2013
When dynamic blocks are inserted they're assigned an anonymous block name. I'd like to be able to retrieve the name of the parent block after selecting the block on screen using AutoLisp.
Need a bit of code that handles this?
View 3 Replies
View Related
Apr 5, 2013
Create a routine that looks for a block based on a portion of that block name, using a specified path or search path.
For example, block to search for is BLOCKABC123, so if someone inputs ABC or 123 as a block name, it will locate that block within that folder and inserts it into the drawing at a user specified location.
Ideally, if there is a check in that if it finds more than one match, then perhaps it flags or prompts you to choose 1, 2, or 3 option which block to use. But I can live without this special function if it requires too much time to code.
View 8 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
Apr 18, 2013
I am learning autolips and i found a problem that i can´t solved.
(vl-load-com)(defun c:pmb ( / ss ent pt )(prompt "
selec block : ")(setq ss (ssget '((0 . "INSERT")))) (setq ent (ssname ss 0)), (setq pt (cdr (assoc 10 (entget ent)))) (command "point" pt))
wich this code you select one block and insert one point at insert point´s block.
which this other code yo select all block and insert all point.... but in one block
(vl-load-com) (defun c:pmb11 ( / sele cod bloque nbloque lista pt ) (prompt "
block: ") (setq sele (ssget ( List'(0 . "INSERT"))) Cod 0 )cod (1+ cod) (repeat (sslength sele) (setq bloque (ssname sele cod)) (setq pt (cdr (assoc 10 ( entget bloque)))) (command "punto" pt) );repeat )
View 4 Replies
View Related
Nov 30, 2012
I have a block that i want to insert several times and revised each one to be different to do this i would have to insert it and rename the blocks that come in and then reinsert i would like to insert and have a lisp explode the main block and rename the other 2 blocks with a suffix at the end depending on how many times its in the drawing... can this even be done? My original block name that will be first inserted is "BENT PULLEY NOTES" it needs to explode after i drop it in and then there are 2 blocks within that called "Bent Pulley" and "Bent Pulley DYN" that i was hoping to keep the names but add a number at the end depending on how many are in the drawing already...
here is a lisp that i have found... it would work if i didn't have nested blocks and only wanted the one block to be insert and not explode...
(defun c:Test (/ e i name Bname )
(setq e nil)
(command "_.-insert" "Drawing1.dwg" pause "" "" "")
(if (setq e (entlast))
[Code] .......
View 9 Replies
View Related
Dec 23, 2013
I have a dwg with 40 blocks that have a non-annotative property. I can go through 1 by 1 and change the property to annotative and redefine the block. Is it possible to automate this? I have done some google searches but have not found anything I am able to cut and paste or put together to get it to work.
Civil 3D 2012 SP4.0 Windows 7 Enterprise 64-bit
C3D 2014 SP1
Dell M6600, Core i7 @ 2.3GHz, 16 GB ram
Dell T3500 workstation, too much ram to post
View 3 Replies
View Related
Oct 1, 2012
How to edit this string so that it would change ONLY XREF layers in a dwg. to color 3 bylayer, and leave all of my additional layers in the current dwg. as is.
^C^Cchprop;(ssget"x");;color;bylayer;;-layer;color;3
View 2 Replies
View Related
Feb 8, 2013
Can you change the color of a block attribute with lisp like you can with the built in Enhanced Attribute Editor function eg
I can change the value of the attribute LAMP but can I also change its color from the color of the layer its created on?
(while (not (equal ck "SEQEND"))
(setq e1 (entnext e1)
e2 (entget e1)
ck (cdr (assoc 0 e2)))
(if (= (cdr (assoc 2 e2)) "LAMP")
(progn
(setq e2 (subst (cons 1 lamp)(assoc 1 e2)e2))
(entmod e2)
(entupd e1)
(setq ctr (+ ctr 1))
)
)
)
View 9 Replies
View Related
Mar 29, 2012
i have this LISP as attach...at moment it works like this as below:-
1) Activate the LISP
2) Automatic select all the preset block name in the lisp and change to a pre-set layer
3) LISP end
Now i wish it to be like this:-
1) Activate the LISP
2) Automatic select all the preset block name in the lisp and change to a pre-set layer
3) At command prompt, will state out " n block have been change to layer Eye Bolt"
4) LISP end
View 1 Replies
View Related
Sep 3, 2004
Is there a way to force a setting in a PC3 file?We have one set up to print rotated and sometimes for whatever reason it changes back to Auto for the rotation. It's under Graphics of the Custom Properties I would like to write something that if a person plots with this PC3 that to rotation will be forced to 90 degrees.
View 4 Replies
View Related
Mar 2, 2012
I am trying to select all blocks of a certian name. I am using the following:
(setq ss1bk (ssget "_X" (list (cons 2 blkname))))
My issue is that this will not select any dynamic or attribute blocks that are not at the default insert state.
how to select all of a block by name including reguardless of current state?
View 9 Replies
View Related
Sep 26, 2013
I have a routine that counts dynamic blocks by visibility state and stores that information then prompts for scale and color and stores that information. Then a legend begins to build from the data and a collection of blocks to reflect the dynamic blocks and their visibility state. Everything works great on all of the machines around the office except on one. When the legend begins building, the one user is getting the DDATTE dialog instead of allowing the values to populate as expected. So, I had him change ATTREQ to 0 an run again. No deal, the same thing happens again and again. And; it only occurs on the one machine.
View 5 Replies
View Related
Feb 21, 2013
I need to get VLA-Object from block name.
here there is a code to get block name from VLA-Object:
(vlax-get-property obj (if (vlax-property-available-p obj 'EffectiveName) 'EffectiveName 'Name) )
but I need the inverse of this code exactly:
blockname(as a string)==>VLA-object
(defun GetVLA_BName (BName).......
so, how can I do it?
View 9 Replies
View Related