Custom Property Question
Custom Property Question
(OP)
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?
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.






RE: Custom Property Question
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
RE: Custom Property Question
I have read that post and it does not describe what I want to do.
We are using MatWebs add-in for solidworks to get materials. However some of the material descriptions become quite long. I know that you can go into the database and edit the name, which we have done for most of them. However some material trade names need to be seen on our drawings. We some way to define the number of characters in the custom property and then text wrap after those characters have been reached. It may be asking too much. but just curious if anyone has found a solution.
Best Regards,
Jon
Challenges are what makes life interesting; overcoming them is what makes life meaningful.
RE: Custom Property Question
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
RE: Custom Property Question
I've been using property field for a long time now, I think I requested it every year to no avail. I would think with 2005, and the PDM works being able to have multiple lines in there comments field that we are close, but still no luck. I just had the same thing asked by people at the company I'm working at ask the same thing. They don't hyperlink anything, and this is their first exposure to doing alot of it. Let me know if you find out anything though!!
John (with an "h")
RE: Custom Property Question
What MatWeb gives you is a .sldmat file which includes all the physical properties for each material. You then can edit material names by editing the file. But in some cases you cannot abbreviate the material name enough to make it fit into our title blocks.
Coverting the info to excel will not help things for us. The material is not called out in the BOM. It is a custom property in the part that hyperlinks to the material chosen.
You would think that a macro could be written to place so many characters in a custom property and then once the charaters are taken up then it would wrap to the next line even though it is only one property in the custom property fields.
If I knew more about creating macros I would take a shot at it myself. I'm just not that savy when comes to programming.
(still seeking help)
Best Regards,
Jon
Challenges are what makes life interesting; overcoming them is what makes life meaningful.
RE: Custom Property Question
RE: Custom Property Question
By the way I am using SW2005 SP1.1
Best Regards,
Jon
Challenges are what makes life interesting; overcoming them is what makes life meaningful.
RE: Custom Property Question
Regards,
Scott Baugh, CSWP
3DVision Technologies
www.3dvisiontech.com
www.scottjbaugh.com
FAQ731-376
FAQ559-716 - SW Fora Users
RE: Custom Property Question
If you read my first post I am not looking at how to tie a custom property to a material. I've been doing that for years.
I am looking at how to wrap the custom property in the title block. The property is only one line of text that is linked to the material that is chosen at the part level. I was hoping there was some way to create a macro or something that would define a number of chracters in a property before it would wrap to the next line. Maybe just put this one on my SW wish list I guess.
Best Regards,
Jon
Challenges are what makes life interesting; overcoming them is what makes life meaningful.
Solidworks 2005 SP1.1
RE: Custom Property Question
Just create another custom property in the part level called "Description2". Then create a link in you title block for that property.
This will be your end result:
$PRPSHEET:{Description}
$PRPSHEET:{Description2}
It's kind of a pain, but it works for now.
Regards,
Macduff
Meggitt Airdynamics Inc.
Dell Precision 370
SW2005 Pro SP 1.1
XP Pro SP2.0
NIVIDA Quadro FX 1300
RE: Custom Property Question
I don't think that is going to work for this. The custom property I have is linked to the material name. ONE property that has a specific number of characters which describes the material type. Your idea would work if I wanted to manually type it in everytime. But I want it to automatiacly update when I change the material at the part level.
Best Regards,
Jon
Challenges are what makes life interesting; overcoming them is what makes life meaningful.
Solidworks 2005 SP1.1
RE: Custom Property Question
That way, you can use the vb string formulas of excel to count, seperate, and fill the multiple custom property values.
The macro could also reposition the text box to allow for the multiple lines if required.
Good Luck
Remember...
"If you don't use your head,
your going to have to use your feet."
RE: Custom Property Question
I was answering Regg's post not yours. I thought he was asking how to insert a custom propety.
Scott Baugh, CSWP
3DVision Technologies
www.3dvisiontech.com
www.scottjbaugh.com
FAQ731-376
FAQ559-716 - SW Fora Users
RE: Custom Property Question
Unfortunately I have no idea what I am doing when it comes to macros. I will see if one of our programmer's here can figure it out.
Thanks for the info.
Best Regards,
Jon
Challenges are what makes life interesting; overcoming them is what makes life meaningful.
Solidworks 2005 SP1.1
RE: Custom Property Question
Then go through the individual steps manually as you normally would. (Try to be exact while doing this!)
Stop recording the macro and save.
That should give your guy a good start.
Other details can then be answered here.
Remember...
"If you don't use your head,
your going to have to use your feet."
RE: Custom Property Question
1) Download one of the many free custom property routines available online and modify the code to use string functions to add in a carriage return after the specified number of characters.
2) Wait until SWX2006 when automatic word wrapping will be included with notes.
RE: Custom Property Question
Do you have a custom property routine that I can modify?
Or know of the website which has these routines for download? I have looked at the macro sites I have saved and none have any routine which carriage return after a set number of characters.
Best Regards,
Jon
Challenges are what makes life interesting; overcoming them is what makes life meaningful.
Solidworks 2005 SP1.1
RE: Custom Property Question
Here is an example macro. You will have to modify PropertyName to the one used in your models and PropertyMaxLength to how many characters you can have before you have to wrap the material. The macro is very simple. It assumes you have a model open with the configuration you want to change the material property in active. I also assumed you want to break the material up at a space character. If you want to break the material up after PropertyMaxLength and do not care if the line feed is inside a word, then take out the code where it checks for the space character.
Regg
-----------------------------------------------------------
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim swConfig As SldWorks.Configuration
Dim ConfigName As String
Dim PropertyValue As String
Dim PropertyName As String
Dim PropertyMaxLength As Long
Dim InsertLFat As Long
Sub main()
'set material property name
PropertyName = "MATERIAL"
PropertyMaxLength = 10
'get required objects
Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Set swConfig = swDoc.GetActiveConfiguration
'get active configuration
ConfigName = swConfig.Name
'Get property value
PropertyValue = swDoc.CustomInfo2(ConfigName, PropertyName)
'check if property value is over max length
If Len(PropertyValue) > PropertyMaxLength Then
'calc where to insert line feed
InsertLFat = InStrRev(Left$(PropertyValue, PropertyMaxLength + 1), Chr$(vbKeySpace))
'check if material can be split
If InsertLFat Then
'insert line feed
Mid$(PropertyValue, InsertLFat, 1) = vbLf
'save custom property
swDoc.CustomInfo2(ConfigName, PropertyName) = PropertyValue
'tell user what happened
MsgBox "Material was sucessfully split"
Else
'tell user what happened
MsgBox "Material cannot be split"
End If
Else
'tell user what happened
MsgBox "Material did not require to be split"
End If
End Sub
RE: Custom Property Question
I need your help. the macro code you gave me is not wraping the material text. Does this macro work at the part, and assembly level?
The material name I have is "Polyphenylene, Extruded"
I set the PropertyMaxLength = 20
I was hoping that it would just wrap the Extruded to the next line but when the macro runs it says that the property did not require to be split.
Does the value I set equal the amount of characters?
In deperate need of help.
Best Regards,
Jon
Challenges are what makes life interesting; overcoming them is what makes life meaningful.
Solidworks 2005 SP1.1
RE: Custom Property Question
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.
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
RE: Custom Property Question
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
RE: Custom Property Question
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
RE: Custom Property Question
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
RE: Custom Property Question
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
RE: Custom Property Question
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
RE: Custom Property Question
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
RE: Custom Property Question
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
RE: Custom Property Question
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
RE: Custom Property Question
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
RE: Custom Property Question
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
RE: Custom Property Question
Best Regards,
Jon
Challenges are what makes life interesting; overcoming them is what makes life meaningful.
Solidworks 2005 SP1.1
RE: Custom Property Question
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