AutoCAD Visual LISP / AutoLISP :: Insert A Block / Explode And Rename Nested Block With Suffix

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


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Tool Palette Macro To Insert Explode Block

Mar 29, 2013

It's been too long since I created one of these for Toolbars. I need a macro that will insert and explode a block. I just need the block's content, not the block itself. I can create a maco to explode a block with no path, but can't remember how to include the "*" in a file with a folder path to explode the block while its being inserted. Because of spaces in the file name, quotes (") must be around the path.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Removing Nested Block From Main Block?

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

AutoCAD Visual LISP / AutoLISP :: Insert Point At List Block And Dynamic Block

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

AutoCAD Visual LISP / AutoLISP :: How To Get Name Of Nested Block

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

AutoCAD Visual LISP / AutoLISP :: Replace Nested Block

Aug 7, 2012

I have a dynamic block that has a nested temporary block inside it. What I am wanting to do is replace the temporary block with the permanent block. I have tried several different variation of coding but I cannot seem to get this bad boy to work. have used:

(vla-put-name (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))) "tempBlockName") "newBlockName")

this gives me a duplicate names error. 

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Distinguish Block That Can't Be Explode In Application?

Dec 21, 2012

How can I distinguish a block that can't be explode in my LISP application? DXF group 280 not present in GETENTITY list.

View 1 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 :: Rename Block With Spaces?

Sep 3, 2012

I have to batchplot a lot of drawings but before that i need to rename a block in every drawing. I want to get from ABC 123 to ABC_123.

this is my code right now for the part to rename the block. 

(princ "-rename
" File#1)
(princ "b
" File#1)
(princ "ABC 123
" File#1)   <---- here i get the problem. 
(princ "ABC_123
" File#1)

This comes in the prompt:

Command: -rename
Enter object type to rename
[Block/Dimstyle/LAyer/LType/Material/multileadeRstyle/Style/Tablestyle/Ucs/VIew/
VPort]: b

Enter old block name: ABC
Cannot find block "ABC".

How do i include space and 123 in the princ?

I am using map3D 2012.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Multiple Block Rename In Sequence

Aug 15, 2011

how to write a LISP that enable me to direct automatic rename multiple block name?

Example is i have 3 block names as " A123 " , " A728 " , " A003 "

When i activate the LISP, it will automatic rename the block name to be " CAD1" , "CAD2" & "CAD3", whereby

the word "CAD" i can change whenever i start to use it change multipld block name.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Block Rename To Attribute Text Value

May 17, 2013

I wanna change my block name to attribute text value, any similar lisp code?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Batch Rename Using Attribute From Title Block

Oct 22, 2009

I am working on a large project where a 3rd Party firm has turned over 100s of drawings that we need to get into our system. The problem is that they did not name their physical files properly. We have a particular numbering system for our drawings, the engineering firm did fill in our attributed title block properly and used our numbering system correctly within the drawing. However, their physical file name follows their format. We need to have the physical file name match the information in the title block to get into our system.

Is there a way to "Batch Rename" these files by reaching into the title block and then renaming the physical file to match the attribute?

I have to be honest, I may use AutoCAD 50 to 60 hours per week, but I am no programmer! I am just the go-to person here for AutoCAD whom is stuck trying to come up with a efficient solution for the project team whose engineering firm could not follow our procedures! I was hoping some sort of batch routine could take care of this problem for us instead of us having to individually rename each physical file one by one.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Odd Insert Block

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

AutoCAD Visual LISP / AutoLISP :: Insert One Or Another Block Into Drawing

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

AutoCAD Visual LISP / AutoLISP :: Insert Block Into Several Drawings

Aug 2, 2013

Any way to insert a block onto many different drawings quickly? I have a title block I need to insert into about 100 drawings. It seems very tedious to open each drawing and insert 100 times.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert Block At Intersection

Oct 15, 2013

I tried to adapt the code provided by scottbolton in the "Insert block at intersection" thread to suit my needs. I would like to be able to enter a block name, and let that block be inserted at intersection points.

But i keep getting a DXF error.

(defun c:sbx (/)
(vl-load-com)
;;;define block used in program
(setq bloktype (getvar "USERS5"))
(prompt "asiswaarde: ")
[code]...... 

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert Point At Every Block?

Apr 19, 2013

I need a routine that inserts a point at the insert point or block named "Insert_Point" at every block in the file. The routine could use the current layer, which would be set prior to starting the routine. If it could request the user for the PDMode value and PDSize that would be great too. This will assist me in creating block libraries.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert Boundary To Title Block?

Jan 3, 2012

1. I want to all selected profiles or blocks set to one object, than continue to select second object,(see attached drawing file). How to write the "ssget" lisp.

2. Command "line" ask me specify next point.

3. Found object boundary prompt me to "select oblect", when i selected profile, with the error: bad argument type: consp.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Inserting Block With Insert Command?

Mar 27, 2012

I am working on a lisp file that lets you select a block and automaticaly change the layer and color in block editor. Afther this it exits block editor, deletes the original block and places the new one.

It works fine accept for the last part.

When i incert my new name whit the insert command it automaticaly changes the name whit autofil so it wil still pot my originial block (the new block name is only two characters shorter than the old one).

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: 2014 - Insert Block With Attributes

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

AutoCAD Visual LISP / AutoLISP :: How To Insert Block On Layer That Is Frozen

Feb 19, 2013

We are using autocad 2010 and I have written a routine that will insert several blocks on to several layers.  I thought it worked flawlessly, until I used it.  Our drawings use layer states.  When one state is in use, all the other layers are frozen.  We want to insert a block, at a specific point chosen by the user, and the lisp routine will insert a couple of other blocks at that same point, but on a layer that is frozen.  Three blocks installed in all, at the same point, on two layers. The routine works if all layers are thawed, but not if the layers are frozen.

(defun c:lP1 () ; this starts the routine
(setq temperr *error*) ; saves *error*
(setq *error* rerr) ; sets the new error variable
(command "_.Undo" "_mark") ; start of "undo" command
[code]....

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert Dynamic Block Programmatically?

Feb 23, 2008

I figured out how to entmake a Block with attributes based on user input for insert point, rotation, etc.

My block is a detail bubble that is a circle with a tail, that cuts the object and shows direction of cut. I will include that with this post.

My problem lies in this. I've used dynamic block features such as linear for the tail length, and the cut length, and angle for the direction of the tail.

My old routine was simple, it would ask for detail point and angle. From that it would insert a block that was just the bubble and draw the tail and cut with a polyline.

Since then I've been able to use entmake, which is a lot more powerful for creating entities in AutoCAD. But for the life of me I can't figure out how to add the dynamic properties of my "new" detail block that has the tail, cut and bubble in one.

what I need in the entmake statement to make this create programmatically instead of inserting the block, then modifying it, if possible.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create / Insert Block In Drawing

Sep 26, 2013

take a look at this piece of my LISP-routine.

(command "_.block" pause pause ss "")

where:

ss  -  is a Selection set of some entities

In the rest of code, I don't change the values of initdia, or cmdecho, or whatever else  

I haven't sill understood them that well.The problem is the following:

When My routine executes this line, I am promted for:

1. block name - that's OK

2. insertion point - that's OK

3. then the block-command receives correctly the entities from ss-selection set - that's OK

4. then all the object dissapear! **Problem here**

The block is created... I can insert it in the drawing from the block-data base...

But is there a way to let this block stay in the drawing ? without disappearing?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Insert Block To Points Taken From Txt File

Jun 28, 2013

I got this code in a web trawl to insert a block to points taken from a txt file......

its coming back with an error as follows:

; === Top statistic:
; Function definition (with number of arguments): ((C:INSERTBLOCKS . 0))
; Check done.

What does this mean and how can I fix it.

(defun c:insertBlocks (/ txtFile xyData expertVar attreqVar)(setq expertVar (getvar "expert"))
(setq attreqVar (getvar "attreq"))
(setvar "expert" 2)(setvar "attreq" 0)
(setq txtFile (open "c:\cad\textfile.txt" "r")) ;

[Code] ......

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert Block In A Specific Layout Using Function

Jan 28, 2012

I would like to insert a block in a specific layout (eg. "LAYOUT13") using the function vla-insertblock

I have already searched the web and this newsgroup but have not found the solution.

View 3 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

AutoCAD Visual LISP / AutoLISP :: Insert Dynamic Block At Default State

Feb 15, 2013

When scanning the BTR (Block Table Records) and encounter a "*U" block definition

how can i know if it relate to dynamic block and have it's name?

acutally my current goal is:

when insert a dynamic block at default state (no change in it's dynamic properties/actions)

it's 'Name and 'EffectiveName is equal, when set some of it's properties it turns to dynamic anonymous

with Name = "*Unn"

Can i programaticlly set the block reference to be dynamic anonymous (with out setting any of it's properties)

cause i would like to modify it's BTR (with out effecting the original BTR dynamic block) but do not want to convert it to static anonymous block.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Modify Property - Insert Polyline As Block

Sep 22, 2011

I am starting with a polyline then i use the pasteblock command to insert that polyline as a block.Now i can pull up the property box and change the xyz scale.

I would like to know how to change these setting in my lisp.The scale will be x=1 y=0.1 z=1

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Attributed Multi Block Insert From Custom DCL

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

AutoCAD Visual LISP / AutoLISP :: Insert North Block Oriented On Two Selected Points

Sep 19, 2012

I am trying to insert a norht block oriented on two selected points with the following

(defun c:North ( / ss )
 ;Orientate North Symbol
 (setq oldos (getvar "osmode"))
 (setq blk (vlax-ename->vla-object (car (entsel "

[Code] .......

I am not sure how to (a) erase the selected north block, then (b) make the  insert north block in its place bit work.

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Write Event Handler For Command Like Insert New Block?

Jul 19, 2012

Is it possible to write an event handler for an autocad event/ command like insert new block? I want the event to trigger the execution of an update routine . something like this post

[URL]

how do I access the autocad object in autolisp?

View 4 Replies View Related







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