Hello :-),
I'm new to the the forum and hope i am at the right place for this:
When selecting any dimension type (from the standard AutoCAD toolbars) i would like it to already be in the layer "dimensions". Currently it starts in layer 0.
I've been browsing the web a bit and found a lot about it but people are talking about LISP's?? I can do magic things in AutoCAD but i am a complete stranger to LISP's, Macro's, etc... Would like to learn but where to start..
Anyway i can cover this with something else then writing an LISP?
Thanks in advance!
Patrick
@Anonymous wrote:
When selecting any dimension type (from the standard AutoCAD toolbars) i would like it to already be in the layer "dimensions". Currently it starts in layer 0.
... Would like to learn but where to start..
Welcome to the forum!
This is a pretty common place to start customizing AutoCAD, so know that many of us can relate to your situation.
Give this a try:
(vl-load-com) ;;;--------------------------------------------------------------------; (defun CommandReactor:Start () (or *CommandReactor* (setq *CommandReactor* (vlr-command-reactor nil '( (:vlr-commandcancelled . CommandReactor:CommandEnded) (:vlr-commandended . CommandReactor:CommandEnded) (:vlr-commandfailed . CommandReactor:CommandEnded) (:vlr-commandwillstart . CommandReactor:CommandWillStart) ) ) ) ) (prompt "\nCommand reactor loaded. ") (princ) ) ;;;--------------------------------------------------------------------; (defun CommandReactor:CommandEnded (rea cmd) (if (and *OldClayer* (wcmatch (strcase (car cmd)) "*DIM*") ) (progn (setvar 'clayer *OldClayer*) (setq *OldClayer* nil) ) ) ) ;;;--------------------------------------------------------------------; (defun CommandReactor:CommandWillStart (rea cmd) (if (wcmatch (strcase (car cmd)) "*DIM*") (progn (setq *OldClayer* (getvar 'clayer)) (vla-add (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) (setq layerName "DIMENSION") ) (setvar 'clayer layerName) ) ) ) ;;;--------------------------------------------------------------------; (CommandReactor:Start) (princ)
"How we think determines what we do, and what we do determines what we get."
"How we think determines what we do, and what we do determines what we get."
BlackBox , I guess you forgot to check if the Layer Name is already existed and set it on instead of creating the same
Layer Name everytime the user invoke any Dimension command call .
Blackbox many thanks for the reply!
The suggested solution i need to copy paste into the visual lisp editor? I am really unskilled in all this so i might need some more help i reckon...
The layer i'd like to use as a standard for my dimensions is actually called "Dimension".
-Patrick
"How we think determines what we do, and what we do determines what we get."
"How we think determines what we do, and what we do determines what we get."
@BlackBox_ wrote:
Tharwat - You didn't try the code before posting, did you? *tisk tisk*
Because if you did, you'd have realized that the vla-Add Method returns either the new item Object created, or the exiting Object without throwing an Exception.
I am sorry , I didn't try the code but just read the code .
It's good to know that the vla-add function is not throwing an error if objects are already existed .
Sorry for the confusion and thanks for the info as well .
Hi blackbox,
You make it look so easy but i am doing something wrong i think..
I typed in Autocad "VLIDE", copy pasted your quoted text, saved that as an .lsp file.
With "load application" in autocad i tried to load it but then it says it can't be loaded?
I think i need babysteps!
@_Tharwat wrote:
@BlackBox_ wrote:
Tharwat - You didn't try the code before posting, did you? *tisk tisk*
Because if you did, you'd have realized that the vla-Add Method returns either the new item Object created, or the exiting Object without throwing an Exception.
I am sorry , I didn't try the code but just read the code .
It's good to know that the vla-add function is not throwing an error if objects are already existed .
Sorry for the confusion and thanks for the info as well .
No worries, my friend. :beer:
"How we think determines what we do, and what we do determines what we get."
@Anonymous wrote:You make it look so easy but i am doing something wrong i think.
That is kind of you to say, Triek.
No worries; we all start somewhere... I stopped using Startup Suite a long, long time ago, so I'll explain how I use AcadDoc.lsp instead (you may have done some of this already, which is fine😞
So, for demonstration purposes, if I were to save the above code to C:\BlackBox\lisp\FOO.lsp, then I would add C:\BlackBox\lisp\ to my SFSP, and add this to AcadDoc.lsp:
(load "FOO.lsp")
"How we think determines what we do, and what we do determines what we get."
I will look into this again to see if i can get it working. Had some sweet vacatanial time since last time :-). I will most likely gonna need a crashcourse on writing LISP's, i am the so called newbie in this :-).
As you mention SECURELOAD in this thread, I'm posting this white paper for you guys to checkout http://adndevblog.typepad.com/autocad/2013/07/all-you-need-to-know-about-autocad-secureload-au.html