Jump to content
Ahankhah

Seeking template name and path of NEW drawing (not QNEWed)

Recommended Posts

Ahankhah

Hi everybody,

 

as I requested in another thread (Finding template of new drawing), I am seeking a way to find out the name and directory of the template file which is used for NEW drawing.

 

 

I tested all ways mentioned in the thread, with no success (shown as follow)

 

(getenv "General\\LastTemplate")
(getenv "LastTemplate")

(vla-get-TemplateDWGPath (vla-get-Files (vla-get-Preferences (vlax-get-acad-object))))

Indeed the returned name and path refers to Qnew template.

 

I appreciate any help

Share this post


Link to post
Share on other sites
Lee Mac

I don't think this is possible Ahankhah - after the template has been selected, a new drawing is created by cloning the settings found in the template file, and as far as I am aware no information pertaining to the filename of the template file is preserved.

 

My only suggestion would have been to use (getenv "LastTemplate") but you already state that this has not been successful.

Share this post


Link to post
Share on other sites
Ahankhah

Lee,

knowing that something is impossible is a kind of solution. It means I must search one less way to get the goal8). (Of course I translated the sentence from Persian to English. I hope you understand me:roll:.)

 

thank you very much.

Share this post


Link to post
Share on other sites
Lee Mac

I understand you perfectly Ahankhah - of course, I'd happily be proven wrong if someone does find a way to determine this information.

 

Lee

Share this post


Link to post
Share on other sites
hmsilva

Using, 'new' or 'qnew' command, the used template will be stored at "LastTemplate".

I'm missing something?

 

Henrique

Share this post


Link to post
Share on other sites
BlackBox

1+

 

Only data that is contained within a given template is available to a resultant new drawing.

 

That said, adding a custom XRecord, etc. to your respective drawing template(s) that identifies the template will show up in all drawings created from same, moving forward.

 

Cheers

Share this post


Link to post
Share on other sites
Ahankhah

Lee, Hmsilva,

I found just now (getenv "LastTemplate") returns correct answer.:o

What dropped me into that wrong (above mentioned) situation was that, I was gotten "LastTemplate" value after issuing "NEW" command and completing :vlr-CommandEnded event, but before entering to the new drawing's view, so LISP returned the previuous value.:x (By the way I was previously "QNEW"ed a drawing.:?)

 

Thank you very much for taking time to contribute your knowledge to me.:oops:

Edited by Ahankhah

Share this post


Link to post
Share on other sites
Ahankhah

BlackBox,

 

although my problem is solved, but your idea is very good in some other cases.

Also, it is possible to set some custom properties via dwgprops.

But my problem was finding the last file opened as template, even if it was not known for the programmer.

Edited by Ahankhah

Share this post


Link to post
Share on other sites
Ahankhah

Lee,

you were not wrong. You just trusted on my claim.:cry:

Edited by Ahankhah

Share this post


Link to post
Share on other sites
BlackBox

although my problem is solved, but your idea is very good in some other cases.

 

A former employer used this methodology (and adaptations of same), to embed corporate disclaimers into our drawings, that would justify legal recourse when competitors used our drawings, etc. but that scenario is still not without some pretty large gaps; just thought it might help you moving forward on this.

 

 

 

Also, it is possible to set some custom properties via dwgprops.

But my problem was finding the last file opened as template, even if it was not known for the programmer.

 

I understand, and know of no way to determine that for existing drawings - only moving forward, as described, unfortunately.

 

In order to determine what template was used, perhaps there's a discipline-specific layer, color of layer, or block definition that is able to be reasonably assumed to be a unique identifier? If so, you could easily query via ODBX en-mass.

 

Cheers

Share this post


Link to post
Share on other sites
Ahankhah

BlackBox, thank you for sharing your idea.

Share this post


Link to post
Share on other sites
BlackBox

You're welcome, my friend.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...