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!

Custom Properties Question 3

Status
Not open for further replies.

deltadog

Mechanical
Mar 28, 2007
6
How can I insert a hard return in the value/text expression column. I have drawing which have this hard return, and it shows up as a box.

I can copy/paste this function, but I would like to know how to insert it without copy/paste.
 
Replies continue below

Recommended for you

Thanks Tick. It's not exactly what I was looking for but it works.
 
I'll try-

Tics method produces the same result, which is to add text directly below original text. However when viewing the text in the custom property cell, I don't see both lines. If I click in the cell, then I can toggle back and forth and see the two lines of text.

The method I was looking for is one that keeps both lines of text on the same line in the custom property cell but they are separated by a symbol that looks just like a small box. Both lines of text are visable in the cell, and you're not required to toggle to see both of them.

It's possible that it is not a solidworks function, maybe a microsoft macro or something.

Does any of that make sense?
 
deltadog,

I believe the same box you are talking about went away with Windows XP.

SA
 
I assume you're linking to the custom property in a note on your drawing. If you use a text box for the drawing note there is no need for the hard return in the custom property.

When placing a note on the drawing, window a text box rather than picking the location for your note. Then you can link to the custom property as you normally do. Resizing the text box will then wrap the text automatically. I have seen situations where I can't make this work the way I want (center-justified text where I want the lines separated in a particular place). It may have been possible, but I didn't spend a lot of time on it.
 
Yes this is linked to a macro.

What I'm trying to find, is the way to enter this macro. Notice the small box between the text lines in the property cell.


When I have this in the property cell:
TEXTWRAP2.JPG

I get this on the drawing:
TEXTWRAP.JPG
 
Another way to get multiple lines is to have configuration-specific properties controlled in a design table. The design table is in Excel, and you can use <alt> + <return> to create line breaks within an Excel cell.

The downside is that this only works for configuration-specific properties.
 
deltadog,

Guess I was wrong, it still shows up. I know it disappeared somewhere after the upgrade to XP years ago.

But that is besides the point. Here is something for you to try. Start a part model. Next create a custom property in a the custom tab called BOX (use uppercase letters as shown) and give it the value x. Then run the following macro:

Code:
Sub main()
    
    Dim swApp As Object
    Dim swDoc As Object
    
    Set swApp = Application.SldWorks
    Set swDoc = swApp.ActiveDoc
    
    swDoc.CustomInfo2("", "BOX") = "First Line" & vbLf & "Second Line"
    
End Sub

Now look at the custom property. You should see First Line but when you click on the value in the Value/Text Expression column you should see First Line[]Second Line.

Is this what you want to do?

SA

 
Thanks Tick (and others)
The consensus around the office here is to use the method that Tick described (<ALT> 0010).
The only problem I see is that it is limited to two lines, and we usually use three for descriptions.
Thanks again.
 
Since SolidWorks now allows (as of 2005) the user to resize a text box, you can just make the text box the size of your title block enty and the text will automatically wrap. If you want it to wrap after a specific word, that may be more of an issue. You may be able to simply add spaces in your custom property entry.

custompropertywrap1nh6.jpg


-Shaggy
 
Don't use the two-line method for description field at all! Seriously. Shaggy's solution is correct. If you don't have 2006 or 2007, there is still a much better method. If I had known that's what you where trying to do, I woulda mentioned this sooner:

Use this macro to make a word wrapped annotation note:


Original (german) version is here:
Don't even try to control how the lines breaks. Not worth the effort. Just let the word land where they may. :) Just leave your annotation note wide enough to handle most scenarios.


Matt
CAD Engineer/ECN Analyst
Silicon Valley, CA
 
deltadog, the title block you show in your picture above looks very familiar.
 
deltadog,

One other thing that you can do is use the comments field on the summary tab of your part/assembly properties form. You can link to this field in the same manner you link to a custom property. This field allows multiple lines and you can insert line breaks where ever you'd like with a simple return.

The downside is that there's only one field like this, but if you only need this to populate your drawing title this will work.
 
Your <alt> + <enter> is great even after taking level 3 excel not one ever showed me that little trick. Thanks! Star for you!

Best Regards,

Scott Baugh, CSWP [pc2]
faq731-376
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor