Custom Properties linking to filename.

  • Follow


Hi:

There was a thread regarding this subject back in May.  I tried to reply 
to it but couldn't get it to work.

Here is a link to the original thread:

http://makeashorterlink.com/?S65C426D8

I would like to try the macro feature method, but I can't seem to figure 
out how to copy/paste the code and make it work in my part files.

Can anyone help with this?

I'm open to a good how-to or sample part file.

Also, could this method work for assemblies as well?  Macro "feature" 
seems to indicate that it won't, but .....

Thanks guys.

Todd
0
Reply tabrake632 (4) 7/19/2004 5:24:11 PM

Todd,

I gave up on this issue back on 05-06-03 when I first started that thread.
I just played with it again and found that if you set
$PRP:"SW-File Name"
as the custom property value, it will actually add the filename.  I don't
think it used to do this when I asked the question back in SW03.  But it
does now (SW04 SP3.0).  I also did a "Save-As" a new filename and it updated
properly.

Now, if I can just remember why I needed to do this way back then, this may
be useful....

-- 
Seth Renigar
Emerald Tool and Mold Inc.
(Remove "SpamFree-" from my address)


"Todd Brake" <tabrake@hotmail.com> wrote in message
news:2m2egmFi72orU1@uni-berlin.de...
> Hi:
>
> There was a thread regarding this subject back in May.  I tried to reply
> to it but couldn't get it to work.
>
> Here is a link to the original thread:
>
> http://makeashorterlink.com/?S65C426D8
>
> I would like to try the macro feature method, but I can't seem to figure
> out how to copy/paste the code and make it work in my part files.
>
> Can anyone help with this?
>
> I'm open to a good how-to or sample part file.
>
> Also, could this method work for assemblies as well?  Macro "feature"
> seems to indicate that it won't, but .....
>
> Thanks guys.
>
> Todd


0
Reply Seth 7/21/2004 2:22:37 PM


I went ahead and made an SWP for everyone...
http://www.mikejwilson.com/solidworks/api-macros/link_filename_to_desc.zip

Summary:

This macro will link the custom property "Description" to the actual
name of the file (minus the extension).

The link will always update every time a CTR-Q is performed

**************************************************************************

Instructions:

*) Start a new part or assembly or open existing

*) Save

*) Tools-> Macro-> Run

*) Select macro

**************************************************************************

Notes:

*) Will work in an assembly or part

*) Document must be saved first before running macro

*) If 'Description' IS in Custom Properties, it must be typed with an
   uppercase 'D' and lowercase for the remaining characters

*) If 'Description' IS NOT in Custom Properties, it will be created

*) Rebuild does not update the custom property! If you do a 'save-as'
   with new file name, rename the part in explorer etc. You must do
   a 'CTRL-Q' to see changes.

*) Does not effect configuration specific properties

**************************************************************************

Maybe someone can update the macro to remove some of the limitations.

Mike Wilson


0
Reply Mike 7/22/2004 10:36:27 PM

The custom property solution serves the same purpose and it automatically
updates with name changes if you do 'save-as'
with new file name or rename the part in explorer.  What would the benefits
be of using this macro instead?

-- 
Seth Renigar
Emerald Tool and Mold Inc.
(Remove "SpamFree-" from my address)


"Mike J. Wilson" <m@w.com> wrote in message
news:50becfcf0bee754034bccfd47250d5bf@news.1usenet.com...
> I went ahead and made an SWP for everyone...
> http://www.mikejwilson.com/solidworks/api-macros/link_filename_to_desc.zip
>
> Summary:
>
> This macro will link the custom property "Description" to the actual
> name of the file (minus the extension).
>
> The link will always update every time a CTR-Q is performed
>
> **************************************************************************
>
> Instructions:
>
> *) Start a new part or assembly or open existing
>
> *) Save
>
> *) Tools-> Macro-> Run
>
> *) Select macro
>
> **************************************************************************
>
> Notes:
>
> *) Will work in an assembly or part
>
> *) Document must be saved first before running macro
>
> *) If 'Description' IS in Custom Properties, it must be typed with an
>    uppercase 'D' and lowercase for the remaining characters
>
> *) If 'Description' IS NOT in Custom Properties, it will be created
>
> *) Rebuild does not update the custom property! If you do a 'save-as'
>    with new file name, rename the part in explorer etc. You must do
>    a 'CTRL-Q' to see changes.
>
> *) Does not effect configuration specific properties
>
> **************************************************************************
>
> Maybe someone can update the macro to remove some of the limitations.
>
> Mike Wilson
>
>


0
Reply Seth 7/23/2004 1:14:42 PM

> "Seth Renigar" wrote...
> What would the benefits be of using this macro instead?

That's what I'd like to know! But since someone went to the trouble
of writing the macro, I figured I'd save it as a file for anyone to learn
from. It's a nice demonstration of a Macro Feature that could be
tweaked to do something else in the future.

Mike


0
Reply Mike 7/23/2004 2:51:43 PM

Someone probably wrote the macro back when (like I said in my first reply)
the custom property solution didn't work.  If I remember correctly, in SW03
when you tried to do this, it would tag on the file extension with the
filename.

-- 
Seth Renigar
Emerald Tool and Mold Inc.
(Remove "SpamFree-" from my address)


"Mike J. Wilson" <m@w.com> wrote in message
news:7811f2bb1de6af77656418b8d431e494@news.1usenet.com...
> > "Seth Renigar" wrote...
> > What would the benefits be of using this macro instead?
>
> That's what I'd like to know! But since someone went to the trouble
> of writing the macro, I figured I'd save it as a file for anyone to learn
> from. It's a nice demonstration of a Macro Feature that could be
> tweaked to do something else in the future.
>
> Mike
>
>


0
Reply Seth 7/23/2004 6:33:44 PM

Mike J. Wilson wrote:
>>"Seth Renigar" wrote...
>>What would the benefits be of using this macro instead?
> 
> 
> That's what I'd like to know! But since someone went to the trouble
> of writing the macro, I figured I'd save it as a file for anyone to learn
> from. It's a nice demonstration of a Macro Feature that could be
> tweaked to do something else in the future.
> 
> Mike
> 
> 

Mike:

Thanks for doing this.  Maybe I misread the old thread but the idea was 
to link the filename to the NUMBER property, not the description property.

Yeah, you could just put the "filename" property into the part number 
area of the titleblock -- provided that your part numbers are always the 
same as the filename.

The automagic nature of this macro really comes in handiest when you use 
a PDM tool which is reading an explicit "number" property -- then you 
end up entering the data twice -- once when you name the file and once 
when you enter in the part number.  Or, if you intend to move to PDM in 
the future, it would save you the hassle of entering in Part Numbers for 
a few hundred parts.  Then again, you'd probably use a script to do that 
  if you didn't have this macro...

Anyway, thanks, and do you have any advice for changing the macro to put 
the filename into the "number" property?

Todd
0
Reply Todd 7/26/2004 6:14:15 PM

> "Todd Brake" wrote...
> Anyway, thanks, and do you have any advice for changing the macro
> to put the filename into the "number" property?

Oh it's no trouble at all for me to edit it...
http://www.mikejwilson.com/solidworks/api-macros/link_filename_to_num.zip

Let us know how it does. Maybe we can improve it?

Mike


0
Reply Mike 7/26/2004 11:38:48 PM

7 Replies
1016 Views

(page loaded in 0.104 seconds)

Similiar Articles:













7/20/2012 3:36:39 PM


Reply: