Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Split a custom property output into two lines? 1

Status
Not open for further replies.

tmalinski

Mechanical
Oct 14, 2002
424
Is there a way to split the output of a custom property into two lines? I have a block defined with the following attribute. This works well except our file names are descriptive and sometimes long winded. I need to split the output into two lines using the dash as the split point

This custom property
$PRPVIEW:"SW-File Name"

Returns this file name in one line
“309P Proposed Cap & Blade - DTW01 WEDM Block Die Inserts”

I want two lines without the dash
309P Proposed Cap & Blade
DTW01 WEDM Block Die Inserts

any help is appreciated

Tom Malinski
Sr Design Engineer
OKay Industries
New Britain CT
 
Replies continue below

Recommended for you

You are getting the "-" because that is the file name.

You may be able to use API to read the file name, strip out the "-" and then use the result to populate properties.

[cheers]
 
CBL, I just want to split the output into two lnes at the dash, I was hoping I could strip out the dash at the same time.

Tom Malinski
Sr Design Engineer
OKay Industries
New Britain CT
 

Hi Tom,

It sounds like you want to insert a carriage return in a custom property.

The only way I know how to do this is to enter the custom property via a design table using the $prp command and in Excel use a carriage return (Alt-Enter) to get the second line.

Let us know if this helps.

good luck,
 
Also, long single-line properties displayed as part of a note in a table in a drawing will automatically wrap.

[bat]Honesty may be the best policy, but insanity is a better defense.[bat]
-SolidWorks API VB programming help
 
Tom,
This is none of my business. If you are just starting out in your part numbering system, I would suggest not controlling file names with descriptions. As your company grows, it would be nothing but trouble.

To answer your question you can use visual basic’s “mid$” function to split the part number into SolidWorks properties PartNumber1 and PartNumber2. Then put that property onto the sheet format.

Please forgive me if I have over stepped my bounds. As you probably already know part numbering system is a very touchy subject.


Bradley
SolidWorks Premim 2007 x64 SP3.1
PDM Works, Intel(R) Pentium(R) D CPU
3.00 GHz, 4 GB RAM, Virtual memory 12577 MB, nVidia 3400
 
TheTick, The "SW-File Name" custom property is the first of several in a block with attributes. So your suggestion would be to use a note in a table to display the same info rather than a block.

$PRPVIEW:"SW-File Name"
$PRPVIEW:"Material"
$PRPVIEW:"Size"
$PRPVIEW:"Quantity" REQD
$PRPVIEW:"Note"

Tom Malinski
Sr Design Engineer
OKay Industries
New Britain CT
 
Thank you for the Star.

Bradley
SolidWorks Premim 2007 x64 SP3.1
PDM Works, Intel(R) Pentium(R) D CPU
3.00 GHz, 4 GB RAM, Virtual memory 12577 MB, nVidia 3400
 
I haven't done too much with this. I did notice this behavior in revision tables. I assume it carries over to general tables.

We use custom properties in parts to carry ECN data, which is then displayed in the drawings. The long descriptions in custom properties will wrap.
 
In SW 2007 (and 2006 I think), you can create text boxes which automatically wrap text. Would it work to use one of those in your block?

Eric
 
Thanks everyone for your replies and help. I am digesting all of this and reviewing the link suggested.
I think using some vb code for left$ or Mid$ function would be good based on my many years past basic programming skills, but I have no idea on how to add this or to make this work with a $PRPVIEW:"SW-File Name" custom property within an attributed block.
If anybody has a sample they could share I would appreciate it very much.

Tom

Tom Malinski
Sr Design Engineer
OKay Industries
New Britain CT
 
I'm posting to this thread because the answers are tantilizing close to what I think I'm looking for ... but not quite there.

I need to split a PDMWorks property $PRP:"revision" into a dash-rev piece and a version piece (a Client doesn't want to change their sheet format). For example, $PRP:"revision" = 01-A-02. I want to create two custom properties: one is 01-A, the other is 02.

I think the VB left type of command seems most interesting, but those that have mentioned it don't know how to apply it in the Custom Properties dialog box. I'm totally clueless and have no VB experience. I understand excel well if that helps.

Any thoughts?

SW2007SP3.0

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor