Jump to content

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


Ahankhah

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...