AutoCAD Visual LISP / AutoLISP :: Creating Formula In Block?
Oct 24, 2012
I've been fighting with building a formula in a block utilizing a field from another block. I have a support steel member that once placed, will be lengthened. I need a distance from center of the pipe to the top of concrete. I created a block with a field referencing the insertion point (center of pipe) it works fine giving me this elevation. I also have another block that is the datum node. I have several fields in this block, and it is located at the bottom of the support steel plate. I am trying to create a field that takes the center of pipe elevation and subtracts the datum node elevation to get a distance. I created the formula referencing the COP elevation field and the elevation of the datum node. The information shows properly where I am building the formula, when I click evaluate, the Preview gives me ##### and when I create the datum node block that is also the output I get. I can't figure out why it won't give me the difference between the two elevation fields. I don't know what I can do differently to have that information in the datum node.
View 1 Replies
ADVERTISEMENT
Apr 11, 2012
I am currently using a field for my elevation tags. The field reads the y-value of a line and displays the results as the elevation. Our local jurisdiction requires that we list elevations from above grade (A.G.L.) as well as from bottom of base plate. The difference is usually 6"-12".
I was wondering if I could create another field that would read the same y-value of a line, but then subtract a predetermined value (6") and display the results.
Currently we have to do the math ourselves and this leaves room for errors and is often very tedious.
View 4 Replies
View Related
Sep 7, 2011
I am trying to put a field formula in an attribute value. Basically I have a block that has a attribute called QTY and it is equal to 1. I can get the object property to equal 1 with this expression:
%<AcObjProp Object(%<\_ObjId #########>%).Textstring>%
The expression above will show a value equal to 1 (as I would expect)
Lets say I have two blocks now and I have the lisp routine combine the field values to get the expression below.
%<AcObjProp Object(%<\_ObjId #########>%).Textstring>%+%<AcObjProp Object(%<\_ObjId #########>%).Textstring>%
In the attribute dialog box it will show 1+1 instead of 2. My question is how do I get it to show 2 with out opening the formula box and evaluating it?
I have also tried.
%<AcExpr(%<AcObjProp Object(%<\_ObjId #########>%).Textstring>%)+(%<AcObjProp Object(%<\_ObjId #########>%).Textstring>%)>%
and
%<AcExpr((%<AcObjProp Object(%<\_ObjId #########>%).Textstring>%)+(%<AcObjProp Object(%<\_ObjId #########>%).Textstring>%))>%
View 5 Replies
View Related
Jul 13, 2013
I'm trying to create a model of arrow with which I could place in drawing in any length and orientation I want with lisp. I was imaging to place two point on this arrow and by placing the two points on my drawing, the length and orientation of the arrow would be define.
I'm trying for hours to create it and my grip for polar stretching don't stay still on my arrow (suppose to be on the peak but go far if I stretch it).
View 9 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
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
Nov 27, 2013
I need to pick a nested block in drawing, I prepared this code to get name of selected blocks:
(defun c:test ( / e obj blkName)(while T (while (Not (setq e (entsel "
Select a BLOCK to edit: ")))) (setq obj (vlax-ename->vla-object (car e))) (if (= (vlax-get-property obj 'ObjectName) "AcDbBlockReference") (setq blkName (vlax-get-property obj (if (vlax-property-available-p obj 'effectivename)'effectivename 'name)) );setq );if (princ (strcat "
Block Name is: " BlkName)));while);defun
But, how to select a nested block?
View 4 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
Aug 5, 2013
I would like to select all instances of a block, and put a new block on top of them using the same properties (insertion, rotation) but am unsure how to do this
View 3 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
Sep 27, 2010
We have a block contain 10 attibs to be seen with 8 differents scales making 80 attribs! (We use that before Annotative features). When we edit this block, we have a LISP that ask for the 10 avlues, and copy it for all the scale.
This lisp use the block ename in argument.
We start to use that block with MLEADER, but we can not edited with our lisp (can not find the ename of the block in the MLEADER definition ).
Is that a way to find this ename, and to be able to modify (our substitute) all the attributes value.
View 3 Replies
View Related
Dec 16, 2011
This probably isn't the correct discussion group but not sure where else to post this.
My sales department wants to be able to create drawings based on entries in selected in their Excel qouting tool. Basically, they want to configure a product in the field, and be able to show the customer the drawing with TrueView. (They don't have AutoCAD installed).
I would think the best I can do, is manipulate a .dxf file based on their selections but that may get very complicated.
View 2 Replies
View Related
Nov 28, 2008
How to write some code which could create variable names like var1, var2, var3, etc. I need to do this because I have a large number to create and the actual number is variable and unknown.
Instead of manually writing a large number of line like
(setq var1 value1)
(setq var2 value2) etc
I used to be able to put 1 line in a loop to create and assign a large number of variables. I remember that it involved the use of the set (not setq) and read functions.
View 9 Replies
View Related
Feb 11, 2013
I am attempting to create a export command for our surveyors that deletes all there point layers and seal layer, then audits and saves the file before opening the etransmit command.
Below is what I currently have.I know there is a better way to do this, but it is above my programing skill right now.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SURVey export(defun C:SRVY () (command "-laydel" ; Delete Survey data "Name" "F0" "Name" "F1" "Name" "F2" "Name" "F3" "Name" "F4" "Name" "F5" "Name" "F6" "Name" "F7" "Name" "F8" "Name" "F9" "Name" "F10" "Name" "F11" "Name" "F99" "Name" "SHEET-SEAL" ENTER "YES" ) (command ".audit" "y") ; Audits file (command "_qsave") ; Save changes (command "-etransmit" "Choose Setup" "ACAD2010" "Create transmittal package" ) (princ))
AutoCAD Civil 3D 2012 (Primary), 2011 by contract.
Dell Percision T3500: MS Windows 7 64-bit SP1; Intel Xeon CPU W3505 @ 2.53GHz, 12.00 GB RAM, NVIDIA Quadro 600
View 1 Replies
View Related
Nov 4, 2012
i'm newbie in customizing tools in autocad especially in creating hatch pattern. i understand that to create new hatch pattern is by adding a new hatch pattern in acad.pat file with specific angle.
my question is is it posibble to create a hatch pattern that can use specific angle follows the object shape?
This is what autocad can do by default this is what i'm trying to create
View 7 Replies
View Related
Nov 12, 2013
I am creating a line using entmake, but I need the start and end point to be variable that was already defined ex.
(entmake '((0 . "LINE")(8 . "FIELD") (10 . line_insert) (11 line_end)))
Command: !line_insert
(29.2813 20.5 0.0)
Command: !line_end
(29.2813 18.5 0.0)
The error I get is
; error: bad DXF group: (10 LINE_INSERT)
What do I do to make it recognize this variable?
View 1 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
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
Sep 5, 2012
I just need the userinput to be incorporated in the insert command but don't know how to segregate the block name from the block path..
;;;PROMPT USER FOR BLOCK NAME HERE
(setq userinBLKNAME (getstring "
Please type in the block name shown in the allrevblocks - ex: IFCC4:"))
;;;INSERT BLOCK BASED ON BLOCK NAME PROVIDED HERE
(command "-insert" "B:\CAD\REVBLOCKS\IFC\"USERINBLKNAME PAUSE "1" "" "")
View 3 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
May 1, 2006
Looking for starting point to writing a routine that will open blocks in a drawing and change the colour.We receive drawings from clients with their blocks and would like to have them changed to our company colours.
So basically, i am looking for something that would within a drawing, change every block to a specific color without exploding and redefining. The colour changes will be the same throughout new drawings.
View 9 Replies
View Related
Apr 22, 2013
I am trying to insert one or another block into a drawing, and i need to do this 8 times per drawing.
(defun C:detector (/ filename gas pressure)
(repeat 8 (initget 1 "Gas Pressure")
(setq filename (getkword "
Enter Detector Type [Gas/Pressure]: "))
(if (= filename "gas") (command "-insert" "*T:\acad\schematic_circuits\suny\sunygasdetectornew.dwg" pause "" "")
(or (if (= filename "pressure")
(command "-insert" "*T:\acad\schematic_circuits\suny\sunypressuretransmitternew.dwg" pause "" ""))
) ;;end or
) ;;end if
) ;;end repeat
)
View 4 Replies
View Related
Nov 6, 2013
(setq plist (vl-directory-files (getvar "dwgprefix") "*.dwg" 1))
(foreach ins1 plist
(setvar "lispinit" 0)
(command "open" ins1)
(command "insert" "C:UsersasmoleyDesktopBSK100_BD" "0.875,0.28125")
(command "save" ins1)
);foreach
(setq plist nil)
bad variable name in SETQ and malformed string on input errors.
View 1 Replies
View Related