TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Serge J. Gianolla on April 13, 2010, 11:15:20 PM
-
When in Layer Manager dialogue box, if you highlight one layer and create a new one, it will have same parameters to the highlighted one. Is there a way to make it behave same from command line? What am I missing? It always creates layer with default value [continuous, white...].
Any idea? Nothing fancy, it is for the macro side of a ToolPalette even Diesel if it can cope!
Thanx
-
I would avoid the command call altogether and would copy all the properties of a layer using VL or AutoLISP - it might be less prone to error that way :-)
-
Perhaps something like:
(defun CopyLayerProps (source dest / itemp layers)
;; Lee Mac ~ 14.04.10
(defun itemp (coll item)
(if (not (vl-catch-all-error-p
(setq result (vl-catch-all-apply
(function vla-item) (list coll item)
)
)
)
)
result
)
)
(if (setq source
(itemp
(setq layers (vla-get-Layers
(vla-get-ActiveDocument
(vlax-get-acad-object)
)
)
)
source
)
)
(progn
(setq dest (cond ( (itemp layers dest))
( (vla-Add layers dest))
)
)
(and
(mapcar
(function
(lambda ( property )
(if (vlax-property-available-p source property)
(vlax-put-property dest property
(vlax-get-property source property)
)
)
)
)
'(Color Description Freeze
LayerOn Linetype Lineweight
Lock Material Plottable ViewportDefault)
)
)
)
)
)
(CopyLayerProps "Old Layer" "New Layer")
New Layer will be created if non-existent
-
Nothing fancy, it is for the macro side of a ToolPalette even Diesel if it can cope!
Perhaps something like:
.....
:lmao:
I'm not picking on you Lee, I just thought it was funny.
-
Yeah, I suppose it wasn't too concise... :|
-
Yeah, I suppose it wasn't too concise... :|
As much as it could be.
-
Thanks guys.
The idea of using command is for portability and maintainance! As a macro it is built in the ToolPalette that can be sent to our interstates or o'seas branches. No need to send a lisp/vlx file, with all issues that may crop along. But ultimately the question still remains! Why is the behaviour different if you go via dialogue instead of command? I am not used to that in AutoCAD.
-
Thanks guys.
The idea of using command is for portability and maintainance! As a macro it is built in the ToolPalette that can be sent to our interstates or o'seas branches. No need to send a lisp/vlx file, with all issues that may crop along. But ultimately the question still remains! Why is the behaviour different if you go via dialogue instead of command? I am not used to that in AutoCAD.
-Layer just wasn't coded that way. At best, it could take on the properties of the current layer, but it obviously doesn't do that.
You have to understand, -Layer predates the Layer Manager GUI.
-
Yeah, but all commands from prompt line predate dialogue box driven ones! Array is the same regardless the method one is using, this is done in order to help with routines that were created 1278 years ago :lmao: so is Block making or PLOT [bar the number of plots]...
-
< .. >
You have to understand, -Layer predates the Layer Manager GUI.
(http://www.theswamp.org/screens/index.php?dir=&file=Green_Tick.png)
also, -Layer was designed for people who know how to use a keyboard :wink:
-
< .. > help with routines that were created 1278 years ago :lmao: ...
:-D
-
< .. >
You have to understand, -Layer predates the Layer Manager GUI.
(http://www.theswamp.org/screens/index.php?dir=&file=Green_Tick.png)
also, -Layer was designed for people who know how to use a keyboard :wink:
The GUI Layer Manger was already around when I started, but as soon as I found -layer, I changed my pgp and never looked back. The only reason I ever open the GUI is to change layer color/linetype properties in the viewport.
-
Surely the way to do it is to use LISP/VLX and avoid command calls - they are the main reason programs don't work in later versions.
-
Surely the way to do it is to use LISP/VLX and avoid command calls - they are the main reason programs don't work in later versions.
Not if it needs to be accomplished with macros, placed within a button or ToolPalette palette.
Just for the record, I have an old set of layer commands (all written with use of command calls) that were written back in 93 that were given to me by an engineer I used to work for. I used them until I learned how to write my own and I know he's still using them to this day.
-
This is embarrassing. I have known most of what I need and forgotten. I would like to write for myself a simplified version of lman, just to switch between half a dozen preset layer states. I have used pull down menus, and I guess that was scripts. But I would like to do it with lisp.
I am slowly coming around to really liking vl-sort, but other than that, if it starts with "vl" I have not needed it - yet.
I can handle the symbol tables well enough, but the LAYERS table is not editable, in the same fashion as others. But it seems I remember a there is a way, or was, to simply freeze & thaw from pure lisp, and that is what I am after.
thanks
roy
-
Check this out Roy :-)
http://autodesk.com/techpubs/autocad/acad2000/dxf/layer_dxf_04.htm (http://autodesk.com/techpubs/autocad/acad2000/dxf/layer_dxf_04.htm)