but I have more than 150 dwg file and I should open all of dwgs one by one and setting ON/OFF for STAMP layer for every drawing and it takes so much time!
I just want to select files and LISP program set the STAMP layer to ON or OFF value.
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.
I am looking for a lisp that will rename all the layouts automatically. I tried the Layoutlist function but the output is not in order. Is there anyway that i can get all the layouts in a drawing from left to right order. for eg. i have layouts from layout1, layout 2........layout10). The layoutlist returns as layout1,layout10 etc...instead of layout 1 layout 2.
I am looking for a lisp routine which will allow me to mirror an object that I pick automatically. I don't want to have to pick the two points to set the mirror line. I just want the point I pick on of the object I select to be the point of the mirror. If that can't happen, I was wondering if the object could mirror at its insertion point (like if it were a block or a text.
How I can modify this code to create a block, ask for a new name for the block, then add the attributes listed inside the code below to the new created block. The lisp does a wonderful job - however, it only works if you already have a block created. We are in the process of drawing components and making blocks one by one, so it makes sense to add the attributes automatically when the block is created. We currently have over 500 components to create as a block and set the attributes to each one by one.
Also I would like to know, If Fields can be used inside the lisp routine. That way we can always have access to the attributes from outside the block and change values for all the blocks at once.
(defun c:addattribs ( / blk def ) (while (not (or (= "" (setq blk (getstring t " Name of block to update: "))) (tblsearch "BLOCK" blk) ) ) (princ (strcat " Block "" blk "" not found.")) ) (if (/= "" blk) (progn (setq def (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) blk)) (vla-addattribute def (getvar 'textsize) acattributemodelockposition "New Attribute 1" (vlax-3D-point 0 0) "NEW_TAG1" "New Value 1" ) (vla-addattribute def (getvar 'textsize) acattributemodelockposition "New Attribute 2" (vlax-3D-point 0 (- (* 1.5 (getvar 'textsize)))) "NEW_TAG2" "New Value 2" ) (command "_.attsync" "_N" blk) ) ) (princ))(vl-load-com) (princ)
I have an autocad file with a simple rectangle in it.
The goal is to offset this rectangle 1" to the inside of the original rectangle, then delete the original rectange.
How could I go about this in autolisp??
I know I could use basic commands to bring up the offset functions, but i'm not too sure how i could write autolisp to offset in the correct direction, and the correctly delete the larger rectangle without deleting the smaller one as well.
Maybe put them on different layers? How I could achieve this?
We are working together whit another firm and we would like to share our tool pallets and lisp routines. The pallets and lisp files we would like to share are quite large so we would like to simply send them a USB stick whit all the files and a title "executable" program that automatically puts them on the right place and changes the appropriate information.
I am working on a lisp routine that automatically inserts a parameter in a block and then ads a stretch command to it. But the problem is that for the stretch command u need to select the drawn parameter. So my plan was to get the name of this parameter (car (entsel)) and feet it to my lisp program. But when i do that it doesn't work because autocad demands a parameter.
How to change the Scale Uniformly property in dynamic blocks accross hundreds of drawings using either/or scripts, lisp, vba or anything else that might do the job.
I just need to open the drawing and select the block (one block per drawing) then edit the scale uniformly property within the block, save then close the drawing and move onto the next drawing.
How to create a lisp to automatically export attributes from selected blocks to defined txt file without having to everytime confirm the file name, location and if the file shall be replaced?
Meaning is that I often export attributes to txt file for further use. It is always the same file (I just overwrite it always).
The way I do it now is selecting blocks, using ATTOUT command, then going to the desktop, selecting ATT.txt file and confirming that it is to be replaced.
Is there a way to make lisp or script that will just do all it in at once?
I found on forum such a lisp as below, but it exports all ablocks on drawing and it exports to txt file which is located in same place as drawing and with same name as drawing. Tried to modify it but without success:
I am running a simple script to color some layers in XRefs. I need to colour all layers in XRef files that don't have part of their name containing the characters NWP and I can do this with the line
-layer c 32 ~*|*NWP*
but then all the layers in the sheet file (not in Xrefs) also turn to 32 which I do not want. Is there some way to include an "except" statement in scripts.
I'm trying to set up an easy way to import layers from a certain dwt. file with a shortcut.
Now I found this code, which kind of works, but doesn't do the whole trick. It works with a Popup where I have to insert the dwt. file. It's also annoying that it opens this file than and I have to close it manually.
I would like to have this without any import options and automatically takes this one file always for the layers.
How to edit this string so that it would change ONLY XREF layers in a dwg. to color 3 bylayer, and leave all of my additional layers in the current dwg. as is.
What the require setting to enable me to lock of several layer continuously when i click the "LAYER OFF" button at the toolbar? I wish to set to be like whenever i use the "LAYER OFF" command, i can direct just continue to click several layers for it to be turn off.
I have an old routine that freezes layers that are off. I would like it to also turn off layers that are frozen. It took a while but I think I figured out how the old routine works. I was having trouble determining how the routine would know if a layer was off or not. I found if the color was a negative number that meant the layer was off (cond ((< (dxf 62 l) 0) (command "f" (dxf 2 l)))). How do I tell if the layer is frozen?
I was also wondering what the character was after the DXF code ie. (dxf 62 l). Is is a lowercase L or an upper case i and what function does it have?
Below is the old routine that freezes layers that are off.
I have the following code that works, most of the time. Actually, it works or completes itself all the time, but there is no "all encompassing" measures incorporated.
All of the reference entities, believe it or not, are on layer "0". There are also some consistent layers, that you can see in the code below. However, a user may create or even remove any layer in the reference drawing. Therefore in my current drawing, I may have layers that are not frozen in the xref.
Like i said, the following code works, but not all encompassing.
I found a lisp in an old post and I edited it alittle with my own layers to have it change to but when I use it, it doesn't deleted the extra layers. It says layer cannot be deleted. Below is part of the code that I am using, I didn't copy all of them since there are alot of layers in the lisp that I added. maybe I copied something wrong I am not sure.
I've inherited management of CAD standards. A third party developed the tool palette - mostly blocks, etc. but there are also icons to add whole series of layers to drawings. Click 'Architectural Layers' you add the architectural layers. Click 'Plumbing Layers' you add the plumbing layers. Since the original implementation, things have been changed.
I'm new to working with scripts and have played with it a little bit but my knowledge is severly lacking, I picked up script pro and have had some success batching simple commands.
What I have is a large database with differing layer convensions that I want be able to run a script that will open rename layers save and close, the layers are not of the same name but similar enough that I could set peramiters for less then a duzon layer names and catch my target then rename it to a standard, for example "A-wall exterior" to "A-WL-EXT", a simple enough command but within the database the "A-wall exterior" could be one of a duzon simmilar names.
My thought was to run the -rename la "layername" "layername" qsave script but when the original layer is not found it gets stuck untill script pro times out and fails. If there is some way to search out names and once found rename that would work.
The purpose is to show the proposed grading plan at a smaller scale so that we can give detailed grading plans to meet City Regulations per ADA codes. I understand that this can be accomplished by blocks and attributes, but when you have hundreds of spot elevations that can become cumbersome and less customizable than mtext. The large scale drawings can not have all of the spots shown or it would be too cluttered. But I want to be able to see all of my elevations when I am working in model space to ensure that all of my leaders and spots move together.
I was able to write a LISP that replaced each node with a block of my choice.However, now I need to find a way now to replace the blocks with different blocks.Each point shares the exact same block called "PILE". Different blocks are on different layers and have 11 different colors. I'd like to replace blocks on layer 1 with a block called "1" and blocks on layer 2 with a block called "2" and so on.I was hoping there would be an easy way to do this in LISP, but I've been unable to get any of my scripts to work.
I've attached a link that visualize what my drawing is currently looking like: [URL] ......
I was wondering if it is possible to change the line weights of all layers in a drawing by factor? What I am trying to do is multiply all lineweights by 0.5 so that all lineweights are cut in half. I could just manually do this, but I have around 1000 layers in the drawing, so I'd rather not lol. However, I forsee a problem becuase layer lineweights cannot be assigned just any value, but instead they come from a predefined list. Which means that when a number is divided in half, that new number might now not be in the list.
So another option would be some way to remap all lineweights. This would work pretty well for me since I only have about 4-6 different lineweights throughout the drawing. So I could just say: All layers with lineweight = 0.024" go to 0.014", and all with 0.014" go to 0.006", and so on.
I am aware of how STBs, CTBs, and the "scale lineweights" option all work. But I am not looking to use those. I want the lineweights coming from the layers themselves.
I have used LISPs before, but unfortunatly I have never written one, so I am not familiar with the syntax.
However now the block retains its layer properties ......ie E-Lighting-Ceil (or what ever I name it) but it drops the block
in RED, instead of its original colour.
Question is Im looking for a macro that will bring in my block as per ^c^c-insert;HVLV-UB610x125;;;;
but also bring it in to a drawing on its original layer that its saved to.
please note that even thou the first code brings it in at layer 0, the blocks layer is also inserted into the DWG however its just not associated to it ..... hence the user has to select the block once he or she has brought it in and then change the layer from the layers manager manually. This is not ideal.
just to recap i just need a macro that will A) bring in a block from a location. And B) keep all the properties it has when it is brought in.
How I can select all layers using the command line?
I am going to write a piece of lisp which will reset all the lineweights for all layers to default and have started by doing it manually on the command line to see what I need to automate.
To start with I choose -layer then LW then type default and it is here I have a problem. It asks enter name list of layers for lineweight default which is where I need to choose all.