Hi,
I have a custom property in a Solidworks Drawing (accessed using file -> properties ...)
prop1 = "These are examples for a string = string1 string 2 string3 string4"
is there a way i can create a new custom property that will substring or break prop1
prop2= string1 string 2 string3 string4
and use prop2 property in the drawing title block to show the value ".string1 string 2 string3 string4"
Appreciate all the help.
SolidworksDrawings And Detailing
this is known as catenating and would need to be done within a custom macro.
one note in a drawing can reference multiple custom properties - just put all of the (relevant) strings into the note.
Here might be another option...
This technique was presented by Josh Brady in a SW World 2011 presentation called "Advanced Equations using SolidWorks API and VBA Code." I tried to find it to post a link, but the sight said it couldn't find the SW World 2011 page. Anyone else have the link? Also, perform a serch on the forum for "VBA Custom Properties" and you will get several similar posts.
The idea is you create your two custom properties: prop1 and prop2. Then you create an equation in the equation editor that inserts some VBA code. This code will read the value of prop1, grab the part of it you want, then set the value of prop2.
Try adding the following text as an equation:
"Val1"= Part.Extension.CustomPropertyManager("").set("pro" & "p2",right(Part.Extension.CustomPropertyManager("").Get("pro" & "p1"),6))
This line "gets" the value of prop1, reads the right-most 6 characters of that property value, and sets prop2 to those six characters. You would need to manipulate this with additional code, but this might give you an idea. I am sure Josh or others can expand on this with ease. This took me an hour to get it to work! And I have now exhausted my entire knowledge on this technique.
Daen
I think it can be simpler than the previous explanations, why don't you create the four separate property notes in an area of the drawing. Then just cut and paste the "prp:text??" into one of the properties, keep at least a space between each one. I have done that more than a few times.
I misread that these were DRAWING based custom properties. I am thinking Bernie's comment below of making several custom properties with the sub-parts of text is best and then joining them in notes when you need the whole thing.