×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Automate to fill Custom Properties?
2

Automate to fill Custom Properties?

Automate to fill Custom Properties?

(OP)
Is it possible to fill automatically the Custom Properties such as “DrawnDate”(=current date short) and "DrawnBy" (=Login Name) in a NEW part/assembly/drawing

If they are already populated, then they should not change.

SWX2007SP2.1 x64

RE: Automate to fill Custom Properties?

Search the web for Custom property programs. there is nothing in SW to do that.

Regards,

Scott Baugh, CSWP pc2
www.scottjbaugh.com
FAQ731-376

RE: Automate to fill Custom Properties?

CODE

Dim Today as String
Today = CStr(Month(Now)) & "/" & CStr(Day(Now)) & "/" & Right(CStr(Year(Now)), 2)
Part.CustomInfo2("", "DrawnDate") = Today

batHonesty may be the best policy, but insanity is a better defense.bat
http://www.EsoxRepublic.com-SolidWorks API VB programming help

RE: Automate to fill Custom Properties?

(OP)
Thanks Matt,
Is there a way of inserting the login name?

RE: Automate to fill Custom Properties?

Login name is something you would have to get from the Windows system.  I think it requires Windows API calls.  <http://www.allapi.net>.  I've done it, but I would have to go look it up all over again.  That means that I'm not going to and it will be faster for you to.poke

RE: Automate to fill Custom Properties?

rofl

cheers

RE: Automate to fill Custom Properties?

If you are using your own custom property editor, I would suggest just having an external .ini that lists the contributors.  I have a sample property editor on my site that provides a quick and dirty method for this within the macro - no external references -(http://sw.fcsuper.com/index.php?name=UpDownload&req=viewdownloaddetails&lid=7).  Problem with using login names is that they tend not to be in human understandable terms.  (does jsenji mean "J. Senji", "Jsenji" or "Jsenj I."?)

Matt
CAD Engineer/ECN Analyst
Silicon Valley, CA
http://sw.fcsuper.com/index.php

RE: Automate to fill Custom Properties?

You can get login name from an environment variable "USERNAME" that holds the Windows login information:

Dim myUserName as String

myUserName = environ("USERNAME")

RE: Automate to fill Custom Properties?

(OP)
Please bear with me; I’m not good in API or any programming.

Is it possible to run these macros automatically when making new drawings?

RE: Automate to fill Custom Properties?

(OP)
I mean these macros to be part of the drawing templates!

RE: Automate to fill Custom Properties?

Yes, but it's not convenient, and not necessary.  You'll need to make an overall SolidWorks add-in that will keep track and active the necessary function at the right now.  Very hard.  Just assign keystrokes to them.  Much easier and lets the user control when to use them.

Matt
CAD Engineer/ECN Analyst
Silicon Valley, CA
http://sw.fcsuper.com/index.php

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources