PDA

View Full Version : layers, linetypes, dimstyles, textstyles



jledgewood
2010-05-20, 12:39 AM
does anyone know of a lisp routine, macro, etc. that would allow me to place layers, linetypes, dimstyles, textstyles, on a tool palette? this was done at my previous firm and I never had a chance to find out how they did it.

my ultimate goal is to get layers, linetypes, dimstyles, textstyles on a tool palette.

rkmcswain
2010-05-20, 12:48 PM
Those are all table items, not graphical entities. So when you say "get on a tool palette", do you mean you want a tool palette button that when clicked, will create a layer, linetype, dimstyle, or textstyle?

Even though you could create a macro to create each of these, you can also just put an "object" (such as a line, text, etc.) in the tool palette, this object will have the desired properties, such as the layer, textstyle, etc., and then ---- when you click this button, the layer or whatever will be created, then press ESC to cancel.

CadDog
2010-05-20, 03:55 PM
does anyone know of a lisp routine, macro, etc. that would allow me to place layers, linetypes, dimstyles, textstyles, on a tool palette? this was done at my previous firm and I never had a chance to find out how they did it.

my ultimate goal is to get layers, linetypes, dimstyles, textstyles on a tool palette.

This is right up my alley but first of all let me ask you a few questons:

>>> Are we talking about "Vanilla AutoCAD"
>>> Which Version 2008, 2010, etc...
>>> Do you know a little lisp
>>> Do you have access to a common service, drive and/or service
>>> Do you or your office use AcadDoc.lsp when starting AutoCAD
>>> Do you have a standard to follow

I have two programs which will handle all of these items:

One is a lisp program and the other a vba (for 2008 and below) or C# for 2010

If you know a little lisp you can easily adjust these program to work with your company's and/or client's standards...

Here is what their interface looks like:
The first is a Lisp which creates standard drawing setting for any given scale.
The second one is VBA Layer Maker. The one is C# Layer Maker for 2010 and beyond.

CadDog
2010-05-20, 04:01 PM
my ultimate goal is to get layers, linetypes, dimstyles, textstyles on a tool palette.

However,

If you are looking for something a lot easier I don't think you be happy because there is a lot of variables you will need to cover and I don't think you can do them all in the tool palette.

But I'm sure there are some member here that can really help you with tool palette if that is the way you would like to start...

Good Luck and let me know what you think...

Opie
2010-05-20, 04:21 PM
Jesse,

Were you able to upload that new c# version, yet?

CadDog
2010-05-20, 05:05 PM
Jesse,

Were you able to upload that new c# version, yet?

Sure, hold on....

Oops...

The file that Oleg sent me is a .rar which keeps the directory structure and zipping it doesn't. I will try to email to you directly...

jledgewood
2010-05-20, 11:33 PM
yes I would like a tool palette button that when clicked, will create a layer, linetype, dimstyle, or textstyle. at my old firm we were able to click on a button on the tool palette that would allow for a group of layers to be put in a drawing e.g. layers that pertain to a floor plan or a rcp, elevation, section, etc.

Opie
2010-05-21, 01:39 AM
Create a drawing containing all these layers/linetypes/dimstyles/textstyles you would like to place on a tool palette. If you want to group items for a particular task, then do so. Otherwise, have one for each tool you would like to have on a palette. Organize these drawings into a folder. In Design Center, you can create a new palette from a drawing full of blocks or a folder full of drawings. For this exercise, do the second option. After the palette is created, edit each tool to explode the block on insert. This should get you closer to where you want to be.

jledgewood
2010-05-21, 06:13 PM
when I explode the block on insertion none of the layers in said block remain in the drawing.

rkmcswain
2010-05-21, 10:21 PM
when I explode the block on insertion none of the layers in said block remain in the drawing.

Since you have been working on it for 3 days now, may I suggest again the method in the second paragraph of this post? I promise it works.

jledgewood
2010-05-22, 06:07 AM
I want to get this right, do I need to actually drag the object in the drawing and then hit esc? or actually click the button once and then hit esc?
when I drag an object into the drawing it will leave me with a block that needs to be purged. I would like to avoid that, being I didn't have to purge out a block when this technique was at my previous firm

irneb
2010-05-25, 09:08 AM
Isn't this the same thing as in your other thread?
http://forums.augi.com/showthread.php?t=117380

irneb
2010-05-25, 09:48 AM
To explain exactly what Robert's mentioned in the other thread:
Create a blank drawing. It should have absolutely no linework inside it.
Create the layers, dimstyles, linetypes, etc. as you would want them.
Save this drawing to a shared folder which will always be available to all.
Open the interface (CUI command).
Add a command to one of your custom CUI files.
The command's macro should be:
^C^C^P(setq InsName (getvar 'InsName))(princ);._-Insert;*DriveLetter:/SharedFolderPath/DwgFileName;0,0,0;;;(setvar 'InsName InsName)(princ)Note, change the back-slashes (\) to forward slashes (/) for the path, otherwise they are interpreted as a pause for user input.
Click the Apply button.
Drag-n-drop the command onto your tool palette, you could also add the command to a toolbar, menu, keyboard shortcut, etc.
Close the CUI dialog.You should now have a button on your palette which will insert the blank drawing as exploded without adding it as a block definition in your current drawing. However, it will add all layers, dimstyles, text styles, linetypes, etc. which are found inside the "blank" library drawing.

The nice thing about this is it's quite easy to modify that "library" drawing by anyone used to ACad. They don't need to know any customization methods to change something.

jledgewood
2010-05-26, 01:40 AM
when I change backslash to forwardslash and proceed to pull the tool into the dwg I get a prompt telling me it doesnt recognize the path to the file.

on a side note, the folder titles within the path name, are they allowed to have spaces between words? or will that create a problem as well?

jledgewood
2010-05-26, 01:47 AM
this time I left the slashes as they were and when I insert into the dwg I get a prompt on the command line asking for the block name

jledgewood
2010-05-26, 01:51 AM
here is what I am placing in the macro:
^C^C^P(setq InsName (getvar 'InsName))(princ);._-Insert;*I:\My eBooks\architecture\cad\jl3 Tool Palettes\jl3 standards\jl3 layers\jl3_a_area_layers;0,0,0;;;(setvar 'InsName InsName)(princ)

irneb
2010-05-26, 06:38 AM
The back-slash in a macro means "Pause for user input", that's why it asks on the command line to type the block's name. That's why you need to change to forward slashes instead. But if your path contains spaces, you need to surround the path with double quotes, so your macro should look like this:
^C^C^P(setq InsName (getvar 'InsName))(princ);._-Insert;"*I:/My eBooks/architecture/cad/jl3 Tool Palettes/jl3 standards/jl3 layers/jl3_a_area_layers";0,0,0;;;(setvar 'InsName InsName)(princ)

jledgewood
2010-05-27, 12:45 AM
that worked. thank you very much for all the help.

jledgewood
2010-05-27, 02:04 AM
one more question. as I had in the past, I would like to create a tool on the tool palette that will create a layer for demo, existing, future, etc. the idea behind these layers as at my previous firm is that you can drag them from the tool palette and they will add a status field extension to every layer already in the dwg. can anyone help me with that?

irneb
2010-05-27, 05:12 AM
When you say "status field extension", how does it do this? Is the layer renamed in some way, or does it get something added / changed in its description, or does it get some added data (e.g. XData)?

Also, should it happen to all layers in the DWG, or just some. If the later how to determine which, some common portion in the name or simply from a list of layer names? Maybe a better explanation would be if you upload a before & after DWG as an example.

In some cases it would only be possible to do something like this using lisp (or some other customization programming). E.g. to rename a layer from the command line you could use the -RENAME;LAyer;OldName;NewName; (notice the hyphen / minus prefix to get the command-line version of Rename), but then you need to know if the layer already exists otherwise there's an error - this you could do by using the lisp tblnext function to step through all the existing layers.

If you want to modify the description of each layer, you can only do so through ActiveX(including Lisp)/ARX/DotNet if you have an ACad prior to 2009. The description was only added to the -LAYER command in 2009.