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.
 
Using Search function with text wrap title block as the keywords, found thread559-97361

[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
 
Thanks CBL,

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.
 
Could you import all the MatWeb data into a spreadsheet, then run a macro to insert a word wrap "signal" where applicable, into each field?

[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
 
Jon,
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")
 
CBL,

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.
 
How is the custom property being entered?
 
The Custom property is entered at the part level. However its value is tied to the material properties that is specified by the user.

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.
 
Scott,

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
 
jksolid,
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 [spin]
Meggitt Airdynamics Inc.
Dell Precision 370
SW2005 Pro SP 1.1
XP Pro SP2.0
NIVIDA Quadro FX 1300

 
macduff,

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
 
The only way at this time, you are going to be able to make this work is if you update your material (or the drawing) via macro.

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."
 
meintsi,

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
 
A nice way to start would be to turn on the macro toolbar, and Start/Record a new macro.

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."
 
You have 2 options:

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.
 
Stoker,

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
 
jksolid,

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
 
Regg,

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top