Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Custom Property Question 1

Status
Not open for further replies.

CADGemini

Mechanical
Joined
May 12, 2004
Messages
481
Location
US
Hello All,

I have done a search on this but have not found an answer to it yet.

I was wondering if it is possible to have a custom property be defined by a set number of characters. If it surpasses the set number of characters it will wrap to the next line. Or am I creating an item on a solidworks wish list?

What we have is a custom property tied to the material that is defined in the part level. That custom property is then defined in our title block, however there is only a pre-defined space for the material text to propagate to. Without having to modify all our title blocks drastically can we have the text wrap to the next line without too much trouble?

Best Regards,
Jon

Challenges are what makes life interesting; overcoming them is what makes life meaningful.
 
jksolid ...

1) This macro is for Configuration Specific properties, not Custom properties.

2) PropertyName = "MATERIAL" ... this is case specific, default is "Material". Make sure your macro matches the property name.

3) Take note of Reggs last sentence regarding spaces. If your material is "1234567890 1234567890 1234567890" & you have PropertyMaxLength = 15 (or anything greater than 10) the word wrap will be inserted in the first space.
If PropertyMaxLength = 25 (or anything greater than 21) the word wrap will be inserted in the second space.



[cheers]
Eng-Tips.com Forum Policies faq731-376
Making the best use of this Forum. faq559-716
How to get answers to your SW questions. faq559-1091
Helpful SW websites every user should be aware of. faq559-520
 
CorBlimeyLimey,

Where I work, we use configurations so much that we use the term custom properties for configurations too. Sorry for the confusion.

jksolid,

CorBlimeyLiimey has a good point. Do you store the material property at the configuration specific level or the document level? If you store at the document level, drop the code that gets the configuration name and change the ConfigName variable to equal "". Did you set the PropertyName variable equal to the name of the property that stores the material in your models? As I stated previously, my code is very simple, it does not check for the existence of the custom property. I am not at my SolidWorks computer tonight so I cannot check this out, but I believe if the custom property it is looking for does not exist, my call will return an empty string (0 length) which will never be longer than any max length you put in (technically you could put in a negative length but that would not be pratical). To answer your first question, the macro will work with parts and assemblies. If you store your material at the document level, it will even work with a drawing.

Regards,

Regg
 
Regg,

We store the property in the "custom" properties which is found in the part/assembly. It then is entered into the drawing using a link from the part/assembly. Also just to be clear up any confusion. The property "Material" that is in the part/assembly has a set value pointing to the material type selected. If no material is selected solidworks puts a value in the field that looks like "<not specified>". I set it up this way so that there is no mistakes made by users when setting density values etc. Plus much more user-friendly when selecting materials. Just point and click.

So what modifications do I need to make to the code to get this to work? I'm sorry I am new to this VB stuff. You say it is a simple code but it looks all greek to me.

CBL,

Thanks you for clearing up my confusion on how the value I enter works. Also I knew that properties are case-sensitive and made sure that my property is spelled in the same way. So that should not be a problem.

Best Regards,
Jon

Challenges are what makes life interesting; overcoming them is what makes life meaningful.

Solidworks 2005 SP1.1
 
Jon,

What I meant by simple code is that there is minimal error checking. Normally when I write a macro or VB program, I put in checks to make sure the code does not stop and give the user some VB error message. I write my own messages like: Active document must be part model.

When you go to File, Properties, select the Custom tab and select the Material property, what is displayed in the Value box? If it is similar to this : "SW-Material@Part1.SLDPRT" then there is no modification I can suggest because the actual material callout is being pulled from your database (if I understand one of your earlier posts). You will have to edit the database.

Regards,

Regg

 
Regg,

That is what is displayed in my value box. I know I can edit the database to shorten the name. But some materials cannot be abbreviated enough to fit in our title blocks. If it were abbreviated too much it could represent a different material to a vendor. Thanks for all your help!

I wonder if there is a way to define a notation width at the drawing level with a macro. So I can still have my material link to the part/assembly and at the drawing level define the note width to a specified character amount. And wrap the text once that amount is reached? Possible or Not?

Best Regards,
Jon

Challenges are what makes life interesting; overcoming them is what makes life meaningful.

Solidworks 2005 SP1.1
 
jksolid,

You could add the linefeed (or carriage return) character in the database. We use to use a material database that was stored in a text file and that is what we did with it. Just a suggestion.

Regg
 
Regg,

What is the linefeed that I need to put in to get it to wrap? I tried a bunch of different things and could not get it to work. Can I put the linefeed wherever I want in the material name value?

Thanks in Advance

Best Regards,
Jon

Challenges are what makes life interesting; overcoming them is what makes life meaningful.

Solidworks 2005 SP1.1
 
In VB terminology, a linefeed is the CHR$(10). You can create this character by doing the following: Either open an existing drawing or make a new one. Create a section view that has a different scale than the drawing. You should see something like the example below.

SECTION A-A
SCALE 1:2

Double-click this text and then click on the first line. Now press the End key. Next press Shift-Ctrl-Right Arrow and then Ctrl-C. To see if you captured the linefeed character. Move the cursor between the T and I in SECTION and press Ctrl-v. If you captured the linefeed, the text will now be broken into three lines. You should be able to insert this character into your database anywhere you like. Keep me informed, I have only done this with text files.

Regards,

Regg
 
Regg,
I've done that before. Tried it way back when with no affect, but in 2005 it works, although no very nicely. What happens is the property field you enter it in acts like multiple lines so you can see the other lines until you click in the edit area of the property. The other thing is the justification doesn't work, you have to manually add spaces if you want anything besides left justification. Two hyperlinks in the same note to description 1 & 2 still functions better (looks wise).

It is frustrating.

John
 
SolidsMaster,

I have been using the linefeed character since SW2001+ without the problems you describe. Although, as I stated earlier, I insert the material callout from a text file with the linefeed imbedded in it and not a database. I am still on SW2004 for a couple more days and I just tried changing justification to center and right. It worked fine. If there is one thing I have learned about SolidWorks (and confirmed by the posts in this forum) is that SolidWorks works differently on different machines. That is what is truely frustrating.

Regards,

Regg

 
Regg,
I hear ya, haven't tried it from imbedded outside of SW. I was taking the linefeed from the section/scale views and copy pasting that way. How does your's display when you view the property from File/properties/custom tab? Thanks.

John
 
I have tried the linefeed as you have discussed and tried pasting into the material database and the result is that it does not work. However we have made a decision to modify the title block in a way that will work for us. I appreciate everyones help with this and look forward to SW2006 so that I can hopefully resolve this issue in another way.

Best Regards,
Jon

Challenges are what makes life interesting; overcoming them is what makes life meaningful.

Solidworks 2005 SP1.1
 
jksolid,

I am sorry the linefeed did not work for you. In a way, I am curious as to why it did not.

SolidsMaster,

When you go to the custom tab, you cannot tell the linefeed is imbedded. Our custom properties program replaces the linefeed with a ¶ (like previous versions of VB did) so we know it is there. Makes for special code but it works for us.

Regards,

Regg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top