AutoCAD Visual LISP / AutoLISP :: Delete Specific Block

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


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Change A Specific Attribute From Specific Block To Specific Value

Dec 7, 2011

I've had a simple lisp I've been using for years that suddenly disappeared.  It required that you identify a block name, tag name, and the value that you want the tag to be.  All of this is performed via command line, so it is scriptable.  Since I lost it, I've been experimenting with -attedit.  This command comes frustratingly close to what I'm looking for, except it only appends an existing tag, or replaces a specific string within the tag; I can't get it to replace the entire tag, regardless of its value.

1> Any lisp routine that does what I describe?
or
2> How to make -attedit replace a tag value without regard to what the value currently is (like a * wildcard)?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine To Delete Specific Blocks From Drawings?

Aug 25, 2005

I need a LISP routine that could delete specific blocks from drawings. I have over 100 drawings, each having 4 blocks that I need to get rid of.

View 9 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 :: SSGet Specific Dynamic Block / Since They Are Anonymous

Sep 19, 2011

If you do a LIST command on a dynamic block... AutoCAD tells you the Block Name as well as the Anonymous Block name.

How can I use ssget to snag all Dynamic Blocks that use the 'Real Block'?

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Delete Empty Block?

Jan 29, 2013

The below gets the block names of empty block records. The blocks may or may not be actually inserted in the dwg. In my case though, apparently they are nested in other blocks in the drawing I am working with... but it looks as if they are part of deeply nested block definitions and therefore cannot be purged.  I checked a couple blocks (the code returns over 1000 in my case) it returns and there are no objects in its definition.

How can I force them out of a drawing - and hopefully reduce it's file size?

(defun NullBlocks (/ block *thisdwg* block nullblocks)
(setq *thisdwg* (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for block (vla-get-blocks *thisdwg*) ;iterate block table
(vla-get-Name block)
(if (= 0 (vla-get-count block))
(setq nullblocks (cons (vla-get-name block) nullblocks))
)
)
nullblocks
)

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Delete And Purge Block By Name

Sep 30, 2013

I would like to use a lisp routine to open all the files in a selected folder, search for a blocks by name, delete them, purge the drawing, save and close.

Is there a routing that can be used to do this?

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Delete Block From Multiple Layouts

Apr 26, 2012

I got a model-file with several layout tabs and I want to delete a block in all layout tabs.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Delete All The Dimensions Inside Selected Block?

Dec 2, 2010

I need a lisp routine which will delete all the dimensions inside selected block or blocks, including nested blocks inside.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Filter For Specific Attribute Tag

Aug 30, 2011

How would one modify

(= (cdr (assoc 0 data)) "ATTRIB")

in order to filter for a certain attribute tag named MYTAG

I am working with a custom LISP routine which reports out to a CSV file, an attribute extraction file - but I need my routine to ONLY evaluate blocks which have the MYTAG attribute tag. Then, if it passes that first check, it evaluates another list of Tags within those blocks - a list of tags which I have specified elsewhere in the code.

I am trying to modify my existing code as little as possible, and I think that if I do it at the line (which I've pasted above) - that will "pre-qualify" my selection set....

ATTACHED LISP IS THE FILE I AM WORKING WITH --- THE ACTUAL LINE I WANT TO MODIFY IS AT:

"(while (eq ENSUB "ATTRIB")"

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating New Drawing With Specific Template

Sep 20, 2013

I have some code that starts a new drawing with a specific template from a lisp routine

(defun ghd:load_newdwg (template / ae-acad-object newdwg)
  (setq ae-acad-object (vlax-get-acad-object))
  (setq newdwg (vla-add (vla-get-documents ae-acad-object) template))
  (vla-put-activedocument ae-acad-object newdwg)
)

The template location and file is stored in variable clienttemplate (and is not the standard template path set under options). All works okay except if I close the new drawing, when I return to the previous drawing that was current when the new drawing was created (i.e. the drawing that the routine was run from). I get the following error:

Command: ; error: Exception occurred: 0xC0000005 (Access Violation)
; error: Unknown exception occurred
; warning: unwind skipped on unknown exception

I assume this has something to do with the original routine not closing/finishing before switching to the new drawing. This is the last line of the routine:

(cond ((= startnewdwg 1) (ghd:load_newdwg clienttemplate)))

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Put Circle To Line After Specific Length

Oct 3, 2013

I need a lisp which is i can draw a line or pline with circle in every 30 meters ( circle diameter and total line or pline length will be optional )

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Erase All Points In Specific Layer

Apr 9, 2013

I have a lisp which I use to erase all points in a specific layer.

(defun cPL ()
 (setq ss1 (ssget "x" (list '(0 . "point")'(8 . "Points"))))
 (command ".erase" ss1 "")
 (princ)
)

It is working only if I have the points in the DWG. If there are no points, I receive "Unknow command DPL". Is there anything I can do in order to avoid this error?

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Can't Delete All Layouts?

Mar 4, 2013

Why can't I get this to work?... okay, it is being used via AcCoreConsole.exe

I get the following...  

; error: bad argument type: VLA-OBJECT nil

(defun delAllLayouts ()
 (vl-load-com)
 (vlax-for item
    (vla-get-Layouts
      (vla-get-ActiveDocument
 
[Code]....

View 7 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 :: Retrieving Block Name Of Anonymous Block

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

AutoCAD Visual LISP / AutoLISP :: Block Insertion Routine Based On Block File Name

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

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 :: 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 :: Quick Select All Blocks From Specific Layer?

Mar 1, 2012

how to quick select all the blocks from a specific layer (for instance XPTO) and export them along with their attributes, exactly as we do by quick selecting them and then, through AutoCAD Express -> Attribute Export Info, but in a script...

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create Polygon Viewport At Specific Scale

Apr 25, 2013

I'd like to run one command that allows the user to draw a polygon viewport then sets that VP to 1/8"=1'-0".

It can be nearly accomplished with a macro, but falls just short because the polygon vp requires an unknown number of clicks, so there is no way to know how many pauses for user input in the macro.

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Disable Snap For Specific Objects Or Layer?

Nov 28, 2012

Is there a LISP code for disabling OSNAP for specific objects or layers?  An automatic disable for multileaders would be useful when fine tuning the text placement. Trouble is you need the snap for the leader end. Maybe you could disable the snap for the text grip only. 

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Draw An Ellipse At A Specific Point On A Drawing

Mar 18, 2008

I need to draw an ellipse at a specific point on a drawing.

i can calc the major and minor and i have a polar point of where it should be drawn.

i just need the code to draw the ellipse.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Add Sequential Number As Suffix To Specific Attribute?

Nov 11, 2011

I currently have a LISP routine that will replace the value of a specific attribute name with sequential numbers in the order that the blocks are selected. Like TCOUNT for attributes - and it only looks for a specific attribute Tag Name called "ID".

However, what I want it to do now, instead of just putting the number into the attribute value, I want the number to be a suffix to the existing default tag value of the tag named "ID" which is "ADDRESS:" for some blocks and "ELEVATION:" for other blocks but the tag name that the routine always has to filter for is "ID". That way the user can pick anywhere on the block - not being forced to pick the tag we want to add numbers to.

What I need the new LISP to do is append a space and then a number to the existing tag value in the block, so that the result would look like "ADDRESS: 1", "ADDRESS: 2", "ADDRESS 3" or "ELEVATION: 1", ELEVATION: 2", etc. depending on whatever the default value for the tag "ID" is.

there are several hundred different block names - but they all have a Tag Name of "ID" - whose default value is sometimes "ADDRESS:" and sometimes "ELEVATION:".

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Print Specific Variable To Text File?

Apr 5, 2013

I'm looking for a way to find out what all plot styles are set in drawings in a sheet set.

We are transitioning from color based pen settings to style based and would like to be able to export a log that shows the variable PSTYLEMODE for each drawing in a sheet set. I plan on using ScriptPro to run it on the full sheet set.

Civil 3D 2013
Windows 7 64-bit
Xeon W3550 3.07 GHz
Nvidia Quadro 4000
12.0 GB RAM

View 2 Replies View Related

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

AutoCAD Visual LISP / AutoLISP :: Block To Annotative Block?

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

AutoCAD Visual LISP / AutoLISP :: Delete All OLE Objects From Drawing

Nov 26, 2012

how to delete all OLE objects from drawing by most efficient way.

There are abt 150 drawings, each has from 2 to 20 or so OLE objects which need to be deleted. OLE objects are on many paper spaces.

I tried to use qselect but it selects only what is in current space.

Would need some lisp or some other methode than all can be deleted (excluding those which resides in blocks).

Tried also yto use ssx and then erase but still it deletes only what is on current space.

Just as additional info, those OLE are all pictures, not xls files for example.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Delete Offset Line

Sep 6, 2013

There are many lisp that draw offset line but what about opposite way , I have wall of double line i need to delete one of them let's say inside wall line .

why i need to do this usually when i tracing in external program like autocad architecture or Revit or archicad  i just need outline of exterior and interior walls !.

is there way that can delete the offset line  ?(or within range predefined in lisp to prevent interfering of lines deletion).

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Delete Text Style Not In Use?

Nov 29, 2012

I cannot purge a textstyle out of my drawing. When I run purge nothing is available.

However if I select the style from the style dialog I am able to select delete and delete the style.

When I use the method on the style (vlax-invoke-method style 'Delete). AutoCAD states:

Automation Error. Object is referenced by other object(s)

The style is defenatly not in use but may have been used in the past.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Layer State Delete

Feb 20, 2013

i have a small lisp and i would like for it to:

when i invoke the plot command, it will first check if there is a layer state called "Temp"if "Temp" exists, then delete "Temp", then re-create "Temp", then switch layer state temporariliy to "Plot" to plot the file, and then switch back to the "Temp" layer state againbasically, the "Plot" layer state will be set based on how the drawing(s) will plot. if a user makes changes here-n-there in the drawing, when the user wants to plot, the software will save current state as "Temp", plot using the "Plot" state, and switch back to "Temp" state at the end. all i am trying to achieve is to somehow over-write the "Temp" state. below is the LISP.
 
(command "undefine" "plot")
(defun clot ()
(if (layerstate-has "Temp")
(layerstate-delete “Temp”)
)

[Code]....

Civil 3D 2013 SP1, Win 7-64 bit
12GB RAM

View 9 Replies View Related







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