Jump to content

"Created By" System Variable


jwhitens

Recommended Posts

I've currently taken on the task of updating my organization's title blocks. I'm utilizing Fields in the title block in conjunction with system and sheet set manager variables. I've noticed in the Field Dialog Box there is a CreateDate field choice to display the date the file was created. My question is, is there - or is it possible to create - a system variable that is capable of retrieving the Windows login name of the user who created the file?

 

There are multiple workstations at my organization and former users capable of creating AutoCAD files. I would like to be able to retrieve their Windows login name (eg. jwhitens) of the user who created the file to display as the "Drawn By" field in my title block.

 

Any help would be greatly appreciated.

 

Thanks!

Link to comment
Share on other sites

How about setting the user name to Joe Bloggs in the Options - System tab. Then point a field to the USERNAME system variable?

The disadvantage to doing this is when Wendy Biggins opens up the drawing & she is noted as the author in the dialogue box.

 

In windows, the way of listing the login name is by using %username%, but I don't know how you can transfer this to AutoCAD. LISP could probably get the info, but it's above my head!

Link to comment
Share on other sites

...or Field category PLOT - Login - Bingo! Please note that this will change depending upon the login that has opened the drawing. I don't know of a way of fixing the original field entry.

Link to comment
Share on other sites

Using lisp etc you can get current user but you would be better assigning an attribute this value not as a field so it stays as one value only.

 

have a look at setvar ? * you will see yourself there multiple times now %username% where is it ?

 

Not it but close (GETENV "computername")

2nd go

Why didn't I think of it (GETENV "username")

Link to comment
Share on other sites

Did you mean:

 

(getvar 'loginname)

...?

 

I started to write a .NET LispFunction for AutoCAD ("GetOwner"?) that would accept a single argument, a file path as a string, that would use System.IO.File Class to return the file's owner... Busy week, just haven't gotten around to finishing it... Maybe tomorrow? *shrug*

Edited by BlackBox
Link to comment
Share on other sites

Not that this is the only way to obtain the file owner per-se; I just enjoyed this little challenge.. My first complete .NET offering "GetOwner" :D

 

Simply NETLOAD the .DLL into your session of AutoCAD, then use as needed at the command line, or within the VLIDE.

 

Example:

 

(GetOwner (findfile "acad.pgp"))

** Notes - Code compiled to .NET framework 3.5, using Kean's plug-in wizard, and tested on Civil 3D 2011 (.NET 3.5), and Civil 3D 2012 (.NET 4.0).

 

Enjoy! :beer:

GetOwner.zip

Link to comment
Share on other sites

Just netloaded the .dll into acaddoc.lsp and it works great when I key in the code in the Command line, Thanks! :)

 

Any ideas on how to utilize this LispFunction so it can be used in a Field such as a LispVariable or DieselExpression? I'd like to create the Field in my Title Block Template file that will extract the Owner's info from the DWG file that I am inserting the Title Block into.

Link to comment
Share on other sites

"Owner's info from the DWG file that I am inserting the Title Block into" you would be far better of having your title block as a template rather than inserting a Title block into a dwg.

 

You need maybe a script that opens your template and then runs a lisp that populates a certain attribute value with owners name it should not be a field, as fields are there to continuously update .

 

You can also create start up lisp that will run when you open a new drawing.

 

Create a menu command that is a "NEW" you can edit the original menu also and patch the default NEW to do something different or even remove it forcing users to create new drawings in the correct manner.

 

The suggestion above are telling you how do what you want do you have any lisp skills ? Insert dwg ?

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