AutoCAD Visual LISP / AutoLISP :: Redefining Multiple Blocks Within Drawing

Mar 23, 2003

I have a lisp routine that uploads all the blocks contained within a specific folder and inserts or redefines all blocks of the same name within the current drawing.

My problem is that when I run the routine I prompts me that it can't fine the folder? I created a folder called "blocks" and is located straight onto my C:..........but it still doesn't work.

;FUNCTION TO UPDATE ALL BLOCKS WITHIN A DRAWING
;FROM A SPECIFIC DIRECTORY

(defun c:bup()
(SETVAR "cmdecho" 0)
(setq sst (ssget "X" (list (cons 0 "INSERT"))))
(setq c1 0)
[code].......

View 3 Replies


ADVERTISEMENT

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 :: Rename Multiple Blocks - Add Suffix?

Oct 30, 2012

I am looking for a lisp routine or rename mulitple blocks by keeping the same name, but adding a suffix to it.

I have used "rename" block to add a prefix to multiple drawings, but it doesnt let you add a suffix. (As far as I can see)

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Change Multiple Blocks Attributes

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

AutoCAD Visual LISP / AutoLISP :: Upgrade Function To Grab Multiple Blocks?

Jan 23, 2012

I was able to find/update a LISP program that returns the dynamic block to its original state, overriding the anonymous name and make the actual block name the effective name. I am in the process of manipulating the LISP program so I can select multiple blocks rather than one at a time.

(defun CYMEFFEC ()(vl-load-com) (setq obj (vlax-ename->vla-object (car (entsel "Select blocks: ")))) (vlax-put obj 'Name (vlax-get obj 'Effectivename)))

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Updating Thousands Of Blocks In Multiple Sub Folders

Feb 4, 2013

I have to update a block in literally thousands of cad files. I have the book "AutoCAD Secrets Every User Should Know About" and the author gives examples of this by using a Batch File, Script File, and then Lisp Routine. Any easier way to do the following:

Insert "Gennnotes=" (updating the block) into any drawing that has this block in the drawing already, if not Quit.

Typically to do this I would open the drawing "insert" "gennotes=", then cancel the command and save the drawing. I have a lot of subfolders that also hold drawings so the command would have to search through each subfolder for dwgs.

Like I mentioned above, I tried to use the Batch File/Script Method but my batch file failed. It could find the folder Autocad 2012 - English. For some reason it was not seeing the spaces in between. Not sure. Here's the batch file portion of the routine:

Batch file:

For /r C:Sybex %%f in (c:sybex*.dwg) do start /wait
C:ACAD2012Autocad 2012 - Englishacad.exe "%%f" /b
C:gennotesupdate.scr

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Batch Rename All Blocks In Drawing?

Feb 29, 2008

I would like to batch rename all blocks in a drawing to NEWJOB01, NEWJOB02 ,etc. I can't use wildcards with RENAME command because the old names don't always have a common name. I prefer to use a lisp routine.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine For Modifying Object Properties In Multiple Blocks?

Dec 27, 2013

I have a CAD file with a couple hundred detail blocks in it, and I am trying to standardize them without haing to block edit each detail block.

What i am trying to do in each block is as follows:

- Explode all dimensions, leaders, and blocks

- Change all objects to layer "0"

- Change all lineweights to default

- Change all object on colors 7 and bylayer to byblock

- Change all text and mtext to arial font

- Delete all points

Civil 3D x64 2012
Win 7 x64 Ultimate
I7 3820 (3.6ghz quad core with HT)
32gig RAM (Corsair XMS3 4x8g)
Intel x z79 mobo (BOXDX79TO 2011 socket)
Radeon HD 7850 2gb GDDR5

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Script For Moving Drawing In Multiple Drawings?

Apr 23, 2013

QT : 1 . I  am looking for a script to move the drawing such that the left bottom corner is placed at 0,0  without any manual intervension. This is to done for all the files in a particular folder.

QT : 2   In the same script file I want one block to be inserted also in each drawing. the block is placed in the network drive . so how to copy the path after putting the insert command.  I tried -insert;  but it is not working how can i give the path in script file.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Drawing With Multiple Xrefs - Create Local Layer Filter

Aug 13, 2013

I often work on drawings which have multiple xrefs, each having up to 100 Layers or more, so the layer manager can be a bit difficult to trawl through to find a local layer to select.

I know how to create a local layer filter using the code ~*|* from the new filter area in layer manager.

Ideally all I want to have to type in is: LOCAL and then the local layer filter would be created, with the filter name being Local-Layers (or similar).

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select All Blocks Like Selected Blocks With Window?

Feb 28, 2011

(defun CELBLKS ( / e blk ss blkl)
 (setq blkl ""  ss (ssadd))
 (while (setq e (entsel "

[Code]....

i have this lsp, it works great but how can modify it if i want select with a window.? exemple: if i have 3 differentes blocks, i want to select them with windows and the lisp select all blocks that are identical of those 3.?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Convert The Blocks In Dwg File To Lines That Are Centered On Those Blocks?

Jan 24, 2012

I have a project in 3D that I would like to export to Stadd.  This requires lines rather than blocks.  Is is possible to convert the blocks in the attached dwg file to to lines that are centered on those blocks?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Custom CUI For Blocks

Jan 11, 2014

I was on an older cad and am now moving to 2014.. my previous cad was heavily customized the old school way, I have decided to learn the CUI (and dynamic blocks)

My old cad has blocks on a drop down menu.. click BATH menu than WC icon, a macro sets the correct layer than inserts the WC.. took time to setup but pretty simple and straight forward (see attached for menu syntax). I also made a toolbar BATH and on that toolbar I made a WC icon.. that’s what I use the most

couple of questions

1) do I have to make a new command in CUI for each block to do the same thing?
2) I looked into the design center, but seems like its too many steps but it seems a toolbar with an icon on it, clicking the icon and a macro sets layer and insert block is still pretty quick..??
3) if a toolbar with an icon is still a fast and less step method, can I open the block and somehow make an icon of it? if so where do I put it?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Any Other Way To Open Up Blocks

Apr 12, 2012

I have this code w/ which I can open up Block Library Blocks for editing.  We have R2012 installed w/out VBA.Our MIS department is impossible to deal with.  We have this new fangled permission hysteria so I cannot install VBA myself.Is there any other way to open up my blocks? What I can I do instead?

(defun CpL () (prompt "...Open Library Block or Xref...")(terpri)
(setq a (entsel)) (setq b (car a )) (setq c (entget b)) (setq d (assoc 2 c))
(setq e (cdr d)) (setq ff (strcat e ".dwg")) (setq PP (findfile FF))
(setq opath (strcat "acadapplication.documents.open ""PP"""))
(command "vbastmt" opath))

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Find And Mark Blocks

Dec 24, 2013

My drawing constitutes of many blocks and other objects , and i need to find specific blocks (with same block name) in my drawing which i cannot find them one by one and i though that i can find them all with lisp routine ..

so , i wanna specify point out of my drawing area and lisp routine will draw to line from basepoint of those blocks to specify point when i select one reference block.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Batch Replace Blocks

Feb 22, 2012

We've recently converted all our microstation drawings to autocad now that the company has decided to go with one cad program company wide.

One of the issues we are having after getting the drawings back from the this co. converting them is the cells to blocks convertion inside the drawing. when we open a drawing and see a "Fuse" block for instance and if it a has multiple inserts, it named them:

Fuse
Fuse_1
Fuse_2 etc....

is there a lisp routine or some command that would replace the "Fuse_*" blocks with "Fuse"..I've been searching the forums and know about the express tool Replace Block but need to be able to automate somehow.

I thought about trying to rename each of the "Fuse_*" but of course it won't let you rename to a block name that already exists..

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Set Basepoint During Insertion Of Blocks

Jan 14, 2013

would like to set a base point during insertion of one block.When not insert by AutoLISP, just type "b" to be able to change the base point.

But when I'm using an AutoLISP that inserts a block, it does not work, it interrupts the sequence of routine.

Lisp:
 
(defun c:carrobox()(setq #clayer (getvar "clayer")) (if (= unidades nil)(setq unidades "cm")).....

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Inserting Blocks With Attributes

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

AutoCAD Visual LISP / AutoLISP :: Flatten Inside Blocks

Apr 17, 2012

I wanted to flatten arcs, circles and lines inside a block using the following lisp (which I found in this forum). I found that sometimes this lisp is unable to flatten the ARCs inside the blocks. I do not understand why it is not working for all the blocks. I have attached a drawing in which this lisp is not working.

(defun c:FlattenRaj ( / blocks stpt enpt inspt )
(vl-load-com)
(setq blocks
(vla-get-blocks
(vla-get-activedocument
[code].......

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Parameters Dynamic Blocks

Feb 20, 2012

I'm using the attached lisp to change the parameters of a dynamic block. In particular, I use the function chgdynprop

(defun c: test () (setq oggfreccia (car (entsel))) (chgdynprop (Vlax-ename-> vla-object oggfreccia) "Distanze1"300.0))

The lisp function works properly, because if I select the block from the bar I can see that property Distanze1 = 300.0

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine To Replace All Blocks

Oct 5, 2011

I am looking for a routine that will replace all blocks named "DgnMisc_nodepoleind" with a block named "DgnMisc_nodepoleind2" keeping the insertion point. I could use (command "-insert" "DgnMisc_nodepoleind=Y:/ACAD2007/DA settings/Library_new_scale1/DgnMisc_nodepoleind2.dwg" NIL ) but my problem is that the block I want to replace is used on two different layers and I only want to replace the ones on layer "TPSYM01".

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Adding Blocks Automatically?

May 29, 2012

I want to find a Lisp routine for building rooms (bedroom, bath, kitchen etc).  example: I want to build a bedroom and every bedroom has the following blocks: smoke detector, door, window, bed, night stand, closet.    Is there a way to run a lisp routine that would just ask me for basepoints and rotation angles of all those blocks?  Basically it would automate building a bedroom by inserting all the blocks for me and just prompting me for basepoints + rotation angles. 

Would a macro be better suited for this? I want to do one for every room - kitchen, bath, bedroom, living, dinning etc.  I already have a nice collection of blocks. 

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Using It To Manipulate Dynamic Blocks?

Mar 8, 2013

I'd like to use AutoLisp to modify and in some cases replace existing dynamic blocks in a drawing.  How can I retrieve existing values and then modify values for the following:

1. Visibility states

2. Distances

3. Rotation angles

4. Flip states

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Nested Blocks In XREFS

Apr 21, 2008

I have an XREF that contain block inserts sometimes nested 2 or 3 levels deep. Given the block names, is it possible to find and translate the insertion point of the nested inserts to the current World UCS?

Ideally I would give a routine the block name and it would scan the current drawing and return a list of the translated insertionpoints>

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Count Dynamic Blocks

Dec 17, 2012

Lisp routine to count the number of dynamic blocks of a specific name ("FD") by windowing an area of the drawing. I have a routine that I've been using to accomplish this, but i don't understand why it doesn't count dynamic blocks.

(DEFUN C:LOCATEFD(/ BLKNAME BLOCKSET TOTAL)
(SETQ BLKNAME "FD")
(PROGN(SETQ BLOCKSET(SSGET(LIST(CONS 2 BLKNAME))))
(IF(= BLOCKSET NIL)

[Code] ....

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select All Anonymous Blocks

Mar 11, 2005

I want to explode all anonymous blocks, but how do I create a selection set of them.?(ssget "x" '((2 . "*U*"))) doesn't work, and is dangerous if you have any blocks with the letter 'u' in them.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Divide With Blocks And Keep Attributes?

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

AutoCAD Visual LISP / AutoLISP :: Create Blocks And Name Them In Sequence?

Jul 13, 2012

i have created an Autolisp routine that creates a drawing made up of structural members, x-refs & surfaces based on a few different user inputs. I now want the program to insert the drawing as a block rather than individual elements. My Idea was simply to use the block command in the lisp routine to create a block and then have the drawing create itself in block editor, and close once it has done. however I am having difficulty thinking of a way that I can get AutoCAD to automatically name this block depending on other blocks in the drawing, i.e. in sequence. The name is irrelevent really, but it would make sence for it to be logical, so... if the last block inserted was "b7" then the next one should be "b8" and so on.

Is there a better way of doing it all together? I have read a bit into "entmake" but i'm not sure on how to use that function.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Rename Blocks Up To A Character?

Oct 3, 2012

I have 30 blocks per drawing about 60 drawings.  Each block starts with the jobname has other block info and then the block type. For example

Bldg31-MechEquip_ABC

Bldg33-MechText_DEF

Bldg45-ElecEquip_GHI

I want the output to be just ABC, DEF, and GHI.

I have a rename script but I dont know where to go from here.  How can I tell it to remove everything up and including  the "_" symbol?

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Draw Polyline Between Two Blocks Of Same Name

Nov 13, 2013

i need a vlisp program to draw polyline between two blocks.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Detect The Blocks Which Has No Sub Entities

Nov 27, 2012

I want to code this lisp. The problem which I face is, In some drawings which come from the client, there are a lot of blocks.

I want to detect the blocks which has no sub-entities (but attribute) and add a rectangle inside this block, If it is an attribute add a line from 0,0, to insertpoint of attribute.

View 5 Replies View Related







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