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
ADVERTISEMENT
Mar 10, 2004
I am trying to create a lisp to delete all the empty layouts from mydrawings. I do not see any code to control this.
View 8 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
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
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
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
Oct 19, 2012
I have some multiline attributes that contain strings that are longer than 250 characters. how to empty the attribute using autolisp?
View 4 Replies
View Related
Jan 23, 2013
I wonder if I have to check if the "ssget" is empty.
I have a lisp to zoom extents in visible objects on the screen.
My interest is to filter before applying:If I have selected objects, it zooms in these objects. If I'm not have selected objects, continue as it is today, applying a zoom in the visible scene.
The result would be similar to a zoom of "3dsmax" (press the Z key)
The atual code
(defun c:ZOBJECTS(/ selectprev)(SETQ selectprev (SSGET "_P"))(command "._UCS" "View")(command "._zoom" "extents")(command ".__zoom" "object" "cross" "-1e99,-1e99" "1e99,1e99" "")(command "._UCS" "previous")(command "._select" selectprev ""))
View 6 Replies
View Related
Nov 1, 2012
The code below collects empty blocks with the intent to delete them.However, it appears that if an Xref is currently 'unloaded' it apparrently collects that too. I could probably just test to see if the block is an Xref and avoid it... but how could I modify this to check if it is loaded and still empty?
(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 9 Replies
View Related
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
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
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
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
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
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
Nov 6, 2013
I have some drawing that contains PHANTOM2 linetype.
I can't delete this linetype from my drawings!
View 9 Replies
View Related
Apr 20, 2011
A plugging we use has just updated and loading double menus causing error messages prompting that menu already exists unable to load.
In my cui the menus are loaded in my enterprise as well as my main.
How do I keep the menu with the same name in my enterprise yet unload the one of the same name in my main (where it shouldn’t be) using lisp (I want to Automate this using lisp, since I'm not always in office at the same time as everyone else)?
View 1 Replies
View Related
Mar 5, 2010
I am looking for code that will delete all the properties within a DWG file.
Searching the forum, I found the following
; Remove any existing Properties
(dictremove (namedobjdict) "DWGPROPS")
However, further research (forum, testing and help system) indicates that it no longer applies to current releases of AutoCAD so my initial happiness was short-lived!
View 6 Replies
View Related
Aug 19, 2012
I have list like (C:projectspr0310.dwg C:projectspr0315.dwg C:projectspr03drawings17.dwg)
Want these three files deleted from C:projectspr03.
View 9 Replies
View Related
Sep 9, 2011
trying to delete a file every time CAD is fired up and/or a new drawing is opened. i cannot make it work so far. planning to incorporate it into acaddoc lsp file.
(defun deletestupidfile()
(vl-load-com)
(setq myname (getvar "loginname"))
(if (= (getenv "PROCESSOR_ARCHITECTURE") "AMD64")
(progn
[code]...
View 5 Replies
View Related
Feb 15, 2013
I have a company .cuix menu that is loaded as a partial menu to the main acad.cuix file. I want to delete all the toolbars and pull down menus associated with it and leave the other stuff in place. This is in Autocad 2011 but should also translate to 2013. So far, I have tried opening the CUI menu, going to the company.cuix partial menu and deleting the toolbars. Then I hit save, then Apply. Toolbars disappear and pulldown menus go away. But when I reload AutoCAD they come back.
View 1 Replies
View Related
Nov 8, 2002
Is there any utilities that can select the entire drawing with the 2d polyline and erase all the polyline less than specify length (eg:10m,20m etc) ?
View 4 Replies
View Related
Jul 29, 2013
lisp program to delete all objects in a drawing based on Layer excluding one layer objects.
in AutoCAD.
Example : I may have 10 layers in a drawings like 1 to 10. I need to delete all objects on 2 to 10 layers.
View 9 Replies
View Related
Dec 6, 2007
I have a program that makes 3d polylines from various data. That 3d pline then gets added to a civil 3d surface as a breakline. I want to modify the pline with my program, but preserve the handle, as I think that is what C3D uses to decide if its part of the surface. I tried this as a sample with no luck:
;DELETE 3RD VERTEXT FROM 3D PLINE
(DEFUN C:T3 ( / EN ENAME ENT ENTL)
;GET 3D PLINE
(SETQ ENT (ENTSEL "
Select 3D Pline:")
[Code] .....
I know you can modify a vertex, but what about add and delete with entmake and entmod? I also considered using activex for this task, but you can only add verticies from what I could tell in the object browser of VBA, not delete them.
What I will be doing is deleting all the verticies and adding back the correct ones. Or if there was a way to transfer a handle to a new entity after deleting the old, that would suffice too.
View 9 Replies
View Related
Feb 14, 2013
Is there a quick way to simultaneously delete all objects in a layer if these objects are found across several layout tabs and model space?
At the moment, I'm getting the objects using: (setq a (ssget "X" '((8 . "Revision"))))
This finds all objects in the drawing, but if I just use: (command "_.erase" a "")
to delete them, only the the objects in the current layout or space are getting deleted...
View 2 Replies
View Related