AutoCAD Visual LISP / AutoLISP :: How To Collect Xrefs Inserted By XATTACH
Jul 3, 2013I have a LISP that use the XATTCH command. How can I collect xrefs inserted by XATTACH? It can be more than one xref.
View 9 RepliesI have a LISP that use the XATTCH command. How can I collect xrefs inserted by XATTACH? It can be more than one xref.
View 9 RepliesThe 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
)
This is what i would like to make a lisp for: if the user gives the number tree the last tree inserted entity's are deleted. If the user gives the number four the last four inserted entity's are deleted.
View 2 Replies View RelatedI 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>
I have been using to copy multiple objects from x-refs. The problem I'm having is that when I have the user input prompts in a macro i can screw up the command if i accidentally miss picking my selection set. I'm new to LISP and having trouble with selection sets and selection filtering.
On another note: I'm trying to rename layers copied this way to remove the "$0$" and using the rename command swapping $0$* with * works, however in the -rename command it does not.
I want to set all the layers on all nested xref's to color 8.
View 9 Replies View RelatedI have been looking around the web to find a quick lsp routine that will take all the xrefs in a drawings and move them back onto layer "xref" or "0" depending on what the design team wants.
The ones I have found don't work or move all the xrefs to separate layers.
I'm using a blocklibrary, where I stored all my blocks, most of them have attributes.
Now I'd like to simplify my workflow and want to update the blocks that I inserted in a drawing trough LISP.
Is there a way to update all inserted blocks and attributes of the whole drawing a once? The idea is, that the LISP checks the whole blocklibrary and updates the inserted blocks that to not match with the once from the library.
I have set up a master set of dwg. files we use to create our construction documents. The files consist of a master file that xrefs base files. All of our files are named using the project # first. (i.e. 2011001c.dwg). I have set up the master set using x's to replace the numbers.
Here is how it works:
XXXXXXXc.dwg (master file) relative path xref's the following files.
XXXXXXXlw.dwg
XXXXXXXvlw.dwg
XXXXXXXeg
XXXXXXXfg
XXXXXXXtitleblock
note: all of these files are saved in the same folder.
I am trying to find a way to keep the xref paths working when I copy the files to a project folder and rename the files using the actual job # insead of the x's as place holders. As it is now, when I change the drawing name the reference is lost and I have to manually change all of the xref paths in the xref manager. Is there a command, program, or lisp routine than can change the file names and update the paths automatically.
who can share with me a lisp which can create layer by xrefs and blocks ( if this can be an optional , would be nice ) ?
even maybe lisp can create layer group filter with "XREF" group name and move layers to inside.
Any code that will select all xrefs in modelspace and bind (insert) them?
the -xref bind command requires explicit names and if I use * it will also bind my titleblock xref in paperspace which I want to avoid.
I'm looking for an easy way to generate a on-line riser diagram of blocks that have been inserted on a floor plan.Here's what I was thinking.
For every instance where the block SLC_DEVICE IS insert on the drawing, the routine would insert the block listed in the "TYPE" and place text equal to what is listed in the "ADDRESS". The TYPE is the actual block name.
Each one of these blocks have a tag of TYPE and ADDRESS. What is in the TYPE tag is the block name of what should be inserted and what is in the ADDRESS tag is the text that should be inserted under the block.
So for example; the routine would find the first instance and the tag TYPE which is "Smoke_Detector" and the tag ADDRESS which is 01:03:001. The routine would insert the block "Smoke_Detector" with the text "01:03:001" directly under it. It would insert the next instance the same way a specified distance from the last; so on so on so on until all instances of the BLOCK (SLC_DEVICE ) have been inserted.
The other part of this would be the Block "NAC&SPK_Circuit" but you would use the Tags "Type", "Candela" AND "NacCkt" to generate the one liner.
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).
Is there a lisp that will allow me to do a continuous dimension, but will alternate the dimension position from low, high, low and high? If there is no lisp already created, how to create one?
See Continuous dimension attachment for example.
I work at a glass and glazing company and this is how we dimension mullion width and DLO. See typical window dimensioning attachment for window elevation with dimensions.
I have a list ("temp.dwg" "temp2.dwg") and would like to add the string "insert text here" into each item in the list resulting in ("insert text heretemp.dwg" "insert textheretemp2.dwg"). how would i go about doing that using LISP?
View 2 Replies View RelatedIs there a way to programatically set a visual style before a drawing actually opens?
We have some huge models and people seem to forget to change their visual styles back to 2D wireframe before saving and exiting drawings. Some models will crash on some workstations when trying to open in a rendered mode.
I found a lisp with a function that looked to set viewport visual styles. But it does not seem to be supported anymore. --> (vla-put-VisualStyle vport 1)
I'm trying to write a lisp routine that, when I invoke the mleader command, osmode is set to "nearest" & orthomode is set off. I then would like the original settings to be returned.
attached is what I have written so far:-
Lisp that switches back on Selection Preview i.e. thickens and highlights lines when you hover over them?I don't know why, but they are always unticking the boxes.
View 4 Replies View RelatedIs it possible to execute a certain command based on multiple selections withinin a dcl? for example: two radio colums, one with selections A and B, and a second with selections 1 and 2. is it possible to program commands based on user selections from each column? ex: if A and 1- do a command. A 2- do a different command, etc...
I tried :
(action_tile "key1" "(setq A t")
(action_tile "key2" "(setq B t")
(action_tile "key3" "(setq 1 t)(done_dialog)")
(action_tile "key4" "(setq 2 t)(done_dialog)")
(if
(and (a) (1)
)
(command ...
but was unsuccessful. no matter which combination was selected, the command under all combinations would run.
I am trying to find a lisp that would get an attribute value (tag name = NBR_5) . I'm trying to run a simple routine that would let the user place the value from the titleblock attribute as text on a drawing. I see a ton of articles regarding getting attributes but I am not well versed in programming.
View 9 Replies View RelatedI have a routine that work fine, but I receive a nil at the end of command. How to fix that?
View 7 Replies View RelatedI'm trying to find acceptable point values to feed to the vlax-3d-point function for a vla-addmtext function. With vanilla lisp I just provide the point as x y = "7/32" "2-3/8". So I assumed that I could drop a 0 in for the z like: (VLAX-3D-POINT "7/32" "2-3/8" 0).
Then I thought I was going to be tricksy and try (vlax-3D-point (getpoint)) believing that I could pick the point and get what I need to feed the function, but yet again, no deal. The command line gave me:
node
of #<variant 8197 ...>
Nothing I can use in my code. So how do I find the point in a format that vlax-3d-point will like?
What is the magic word for put a point at each end of an arc, the lisp I have only put a point at center of the arc.
(defun cAA ( / i j ss e1 e2 p1 p2 p3 points )
(if (setq i -1 ss (ssget '((0 . "ARC"))))
(progn
[Code].....
Is there a quick way of getting the value of an attribute?
I have an attributed block called "tp_attributes" and it has and attribute called "OrderNum".
I just want to be able to quickly grab that value.
I use Spell Check regularly and I always check the entire drawing. I would like to add to the Spell macro so that when I pick Spell from the toolbar it goes past the Check Spelling window and begins checking the entire drawing.
I believe I need to insert Alt S into my macro to select Start from the window to begin the check. Is there a character or series of characters that will represent Alt in a macro?
I upgraded from Autocad 2004 to 2012 recently and my lisp file doesnt work anymore.
what it's supposed to do is when looking at the layout tab that you want you can switch to the model space location of the same zoom as the layout tab without messing with the layout zoom.
(defun c:msp ()
(setq cm (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command"view" "d" "tmp")
(setvar "tilemode" 0)
(command"pspace")
(princ "Click TWICE on desired VPORT: ")
(command "mspace" pause "view" "s" "tmp")(princ)
(setvar "tilemode" 1)
(command "view" "r" "tmp")
(setvar"cmdecho" cm)
(princ)
)
I need a program that simulate this DOS command: dir /on/b *.dwg >list.txt
it list all dwg files on current open dwg file folder and sort them and finally put them in a text file with list.txt name. something like thistype list.txt)
test1.dwg
test2.dwg
test100.dwg
test256.dwg
test1005.dwg
(sort alphabetically and logically) because of disabled DOS utility in my PC I need a pure lisp functions, I tried to wrote this program but I couldn't!!
(defun c:listMaker()
(vl-load-com)
(setq path (getvar "dwgprefix"))
(setq fn "list.txt")
[code]...
and also I need a append a string(='This Is EOF') in the last line of the "list.txt" file.
I have text objects with the same Z value and I will select as follows:
(setq sstxt (ssget '((0 . "TEXT")(8 . "APS-text"))))
How to store this value in another variable "zvalue" to apply to:
(command "change" "select text objects" "" "_p" "_e" zvalue "") ?
the following returns true since the @ symbol tests for an alpha character.. (wcmatch "S101" "@*").What is the Dot Net equivalent?
View 2 Replies View RelatedIs there a command that is the opposite of starting an application to open up a file? Like:
(startapp "PlaySound.exe" (findfile "CuckooClock.wav"))
Instead of starting an application, how to shut all of its instances down. Let’s say I have iTunes and/or Internet Explorer w/ a few tabs open and I can close them down without getting to the application to terminate it the usual way.
Naturally,
(endapp "iTunes.exe") doesn’t work :-))
I am trying to get my original layer and lintype reinstated after the user is finished with the pline..I know Im suppose to use the while command but am now completely lost on which way to do this
(DEFUN c:TEST1 ()(if (not (tblsearch "LTYPE" "MYWC")) (command "-linetype" "LOAD" "MYWC" "C:/COUNTER.LIN" ""));SECOND PROGRAM...;CREATE CORESPONDING LAYER...(command "._Layer" "Make" "WC LEIDING" "Ltype" "Continuous" "" "Color" "211" "" "")(SETQ MYOLDCELTYPE (GETVAR "CELTYPE"))(SETVAR "CELTYPE" "MYWC")(while (PROGN(COMMAND "pline")(SETVAR "CELTYPE" MYOLDCELTYPE)))