AutoCAD Visual LISP / AutoLISP :: Converting Objects Of Certain Linetype To A New Layer
Oct 26, 2012
I would like converting all objects that has forced linetype to be on a linetype layer.
So if there are objects that have forced linetypes - dashed/hidden/phantom, etc., those entities would be moved to a linetype layer based on their forced linetype. The entities would all be changed to color bylayer, linetype bylayer.
So if there is a rectangle that is sitting on an EQUIPMENT layer, the routine would put that rectangle on a new layer called DASHED and change its forced linetype to BYLAYER.
Lastly, once that's done, the next and final step is to locate a the existing layers with matching linetype - say, OBJECTS with DASHED as a linetype, and merging it to that layer.
I need to do three things in a LISP routine for around 200 drawings. First, I need rename lots of old layer to new standard layer name, like change layer name "CL-RAILWAY-0" to new layer name "CL-0".
Secondly, I need translate some layer to standard layer, like all the things on layer "CL-WATER-160" to layer "CL-0"
Last, change some linetype, like change linetype"CENTER" to "CENTERLINE". I can do all those things by "CHECKSTANDARD" manually, but I really need someway faster and easier.
how to write a lisp that when i activate it, it will change all the objects in the drawings to be change to "Layer 0" and all linetypes "Dashed" change to be "hidden"...
Say I have 2 items, one is on layer "M-Duct" and the other on "M-Pipe" (they are in the same drawing). Any lisp routine that would create the layers "M-Duct-New" and "M-Pipe-New" (based on the same color and LT as the original layers) and then move those objects to the newly created layers?
I find that the command to move objects to a different layers runs very slow in one of the drawing. I want to find out what wrong with the drawing and how to speed things up.
I have a LISP program that batch processes a large number of drawings. One of the step to process each drawing is to change the colors of some objects according to the status of the objects. I do this by moving the objects to a later that has the right color. So far the program only takes 2 to 4 minutes to process each drawing. But the program takes close to 90 minutes to process one specific drawing. I track down the problem has to do with the command that moves the objects to the right layer, like this:
This command takes a very long time to finish, like 40 minutes each time it runs (to move 1200+ objects), and the program needs to run it twice for a total of approximately 80 minutes.
Please note that the drawing itself is not the largest drawing, and it doesn't have the largest number of objects to be moved either. It is close to the top-5 drawings in term of drawing size and the number of objects to be moved. I cannot say that the drawing size or the number of objects to be moved are the cause of the problem.
I tried to "speed up" by moving 200 objects incrementally. That didn't work. I tried to "speed up" by moving 100 objects incrementally and saving the drawing after each 100 objects are moved. That didn't work either; actually the speed is slightly slower than simply moving 1200+ objects all at once.
I don't know what to do. I believe there may be something unusual about that drawing. By the way, the reason why I choose to change color by moving objects to a different layer has to do with the fact that I have found this is the best way so far. I tried to change the color of the objects directly. But I find that the color of some sub-parts of the objects are not changed (because their color is by-layer). That's why I choose to change color by moving objects to a different layer.
How I can check the drawing, any different way to change color that is better.
Can I have a lisp to select all objects in the layer "Defpoints" (including model and paper space, and including objects inside blocks) and change the color of those objects to color 30?
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.
i have line in the drawing that exists on layer A-Wall it has different lineweight 0.05 from true wall. Now usually my routine : i select this line and then select similar to convert it to layer glazing.
i need lisp that by one command convert the objects on layer A-wall with layer 0.05 only to glazing.
In our Structural department, we use a layer called S-35-WALL-LB to denote a load-bearing wall, and what the guys typically do when they are on the sheet showing the floor above, is dbl-clk the VP to activate model space, open the Layer Manager and change the VP linetype to HIDDEN to show the afore-mentioned loadbearing walls as walls under.
way to accomplish this through a viewport...but instead of using the Layer Manager, use a lisp routine I can link to a toolbar button where all the user has to do is dbl-clk the VP, press the toolbar button, and either it will convert the default VP linetype (continuous) for S-35-WALL-LB automatically, or get the user to select an object on that layer and it changes the whole lot?
I've got a linetype that's part of our autocad template file and has been for so long that nobody around here even knows where the original line file is.
I need to extract the linetype out so that I can make some minor modifications. I did do a search and found a nifty lsp routine from Paul Turvill. (Here's the thread that pointed me there: [URL] ..........
I ran it and it SEEMED to work. All the linetypes in the file it created look good EXCEPT for the one I needed to extract. That one looks like this in the line file:
*TREELINE,Series of arcs used to indicate tree drip lines A,0.0001,-0.0001,
The linetype DOES display properly in the dwg file (meaning lines drawn using it look good).
How can I get the color that a layer has assumed in an specific viewport, and the same for an specific Linetype when it changed with an VPLAYER command
I have a custom linetype that's just a series of arrows I want to use to show the flow of a ditch. I've played around with this thing for a while and have these dots at each end of the line that shows up when I print.
Is there any way to make this linetype without the dots at each end? the actual files for the line type.
I want to know how to create linetype with double lines one rectangle empty and other with solid in autocad(i am using autocad 2004)I tried by express tools with command mkshape (and then makelinetype command) but it is coming without solid, is it possible in autocad by using Autolisp, see attached dwg, name is linetype_ds
I have a client who requested some complex custom linetypes. (line - shape - line)
I built the shapes and stored them in my ltype.shp file, and compiled that to ltype.shx. Then I added the custom linetypes in my acad.lin file. So everything works on my machine with no problem. However, when I send the drawing to someone else, the linetype works, but the shapes are left out. My guess is that since her ltype.shx file does not contain my new shapes, the lines are just drawn without them.
Is there a way that I can have those linetypes, complete with shapes, ride along inside/embedded the dwg file?
And before you ask, no, it's not an option to provide the client with the shx file that contains these shapes. I'm one of many different people in many different companies that might work on these drawings in the future and there's just no way that they'll be able to send an shx file along with the drawing every time someone new needs to work on it.
I have a Lisp that I have been working on with some folks in the office, and i feel like i am close, but i am not getting the cigar. The idea would be to have the lisp allow the user to select a nested x-ref entity, and change the color and linetype of the selected layer, similar to the old "LAP" command (I know it is a dinosaur, but I still miss it). I seem to be doing swimmingly, code I have quasi-plagiarized. It seems to crap out where i try to pass the selected linetype back to the layer. I get the nastygram "Command: ; error: no function definition: GETLINETYPE" right after selecting the linetype from the dialog.
Code below...
x(defun c:CX (/ Sel EntList DataList cnt Num ClrNum EntData) (if (setq Sel (nentsel " Select object to change layers color and linetype: ")) (progn
I have started using Balsamiq mockups [URL]...... for preparing mockups of dialog boxes
The one I have created below still needs tweeking. Creating DCL files from xml or html?
Balsamiq Mockups is really cool and worth checking out. The dialog boxes are saved as bmml files which is based on XML. I am keen to try to create a way to translate the bmml file to dcl.
Here is a sample of what the code looks like from a sample bmml file:
I'm looking for a lisp routine which will 'convert' number of 2dsolid into hatch. Drawing contains dozens of 2dsolids (solids are on one layer, there are also other entities on this layer) which have different colors, have common verticies and edges. i.e. I want to kind of 'join' solids of the same color and convert them into one hatch colored as original solids and placed on existing layer (let it be layer '0' zero for now). Same color solids can exist in few locations - there is a case to make few separate hatches of the same color (all joined solids should be represented as 1 hatch, should not separate after separate hatch command). There is max of 20 different colors (all of them from ACI index). Solids are not crossing themself or other solids (just joining with 1 or 2 verticies).
There are also 2dsolids with 'zero-area' - represented as a line - those should be erased at the beginning (not to have a line-like hatch).
I need to be able to convert "polylines" (as opposed to "2d polylines") to 3d polylines. Here is the issue: the polylines that I want to convert have object data attached to them and they are at the proper Z elevation. When I use the "Convert 2d to 3d polyline" function, the conversion does take place, but all of my object data is removed from the object. And since one of my attributes reflects the overall elevation of the object (which all of the verticies will be the same elevation - even though it will be a 3d polyline), there are too many objects to individually update the attribute information when I am pressed for time.I am working in Civil 3d 2010. Any way to do this using Civil 3d?
The multileader should end up on the same layer as the Mtext. (Currently it uses the current layer.)The multileader should hold the same rotation as the Mtext. (Currently it goes to zero.)The multileader should be created in the same location as the Mtext, without the user having to click. (Currently the multileader is created wherever the user clicks.)The multileader should be created without a leader. We can add one afterwards if needed, but for many we don't need a leader. (We're just using the object as mtext with a box around it.)
lisp..It work fine but just that i need some minor modificatio to it...At moment, when i activate the lisp, it will automatic select all dimension,leader and multileader to a layer call "DIMENSION"...Anyway i wonder if it is possible to prevent any dimension,leader or multileader in layer "Section" will not be change to layer "Dimension"?
Possible to link an xref layer and local layer so they display the same (eg. sync viewport colour, linewieght, line type)?
I insert xref's for my base drawing but legend is on local layers and I would like to be able to ensure that the line colour and linetype always match...