Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Custom properties: Selectively enabling/disabling a note? 1

Status
Not open for further replies.

BiPolarMoment

Mechanical
Mar 28, 2006
625
I'm hoping this is easy but I have a feeling it's not supported.

Is there a way through the custom properties to disable/enable a specific note without simply clearing it to a space?

E.g. I'd like to have a "Draft saved <date> by <person>" (which I can easily do with a note) enabled/disabled externally (like thru Solidworks explorer). If it were a simpler string I would just clear it to " " but since it contains references to sheet properties it would be a hassle if I wanted to enable it again.

Any ideas?

(SW2006)
 
Replies continue below

Recommended for you

By "enabling/disabling a note" do you mean show and hide the note? Or have the <date> and <person> portions left blank?

Can you just move the note out of the printed area?

Better yet create and use a different Sheet Formats. One with the note and one without. Then simply switch the SF to suit.

[cheers]
 
I want to hide the whole note; Show/hide would work but I'd prefer for someone to be able to do it without opening the drawing in Solidworks.

Right now I'm planning on moving it out of the printed area, but was hoping maybe there was an option I didn't know about.
 
CBL said:
Switching templates can be done without opening SW.

Switching templates? I took a quick look at the linked FAQ, but I didn't see anything about switching templates without SW open. Did you mean custom properties?

-handleman, CSWP (The new, easy test)
 
Don't see anything on PropaGator about switching sheet formats, just changing custom properties. The macros referenced operate on the active document in SW.

I swear, I'm not just trying to be a pain... :)

-handleman, CSWP (The new, easy test)
 
Propagator seems like a nice resource though, so thanks for that. :)
 
I stand corrected. Thanks!

Do you still run PropaGator? I'm very curious as to whether it actually opens SW in the background to do the sheet format change. I don't see how it would do it otherwise, since the sheet format data (title block lines, notes etc) is saved in the drawing file.

-handleman, CSWP (The new, easy test)
 
I don't currently have an installed copy of Propagator, but a free version can be downloaded from Custom Solids.

If I remember correctly, SW is opened in the background.

[cheers]
 
Not that this will help but I saw in a PDMWorks Enterprise demo where they had a watermark that was a custom property that they disabled / enabled by editing the note card for the file.

Do you have any other programs that can edit the custom properties without SW? I believe all PDMWorks Enterprise did was change the text from something i.e. Advanced Print to a blank or space.

Don
 
Is it possible for a Macro to do this in sequence:

1) unhide note(s) if hidden (and how?)
2) save
3) save as pdf

Similarly, another to do the same except to hide if not hidden.
 
You could place the note(s) onto a layer and then hide/show the layer. I don't know if that can be controlled by a macro.

[cheers]
 
Yeah, I'm not too up on my API either.

I'm mostly concerned with either a) making it controllable outside solidworks (my original post) or b) making a macro that automates saving with "UNRELEASED" (and the save date) enabled. (The other macro would be used upon drawing release)

Once we get some PDM going this may become a non-issue, but for now I'm working with what I've got. Moving the note on/off the drawing is not bad for one-offs but when it's 20-30 drawings I'll spend 10 minutes to save 20 if I can.
 
Is it possible for a Macro to do this in sequence:
1) unhide note(s) if hidden (and how?)
2) save
3) save as pdf

Answer for (1)
-I "think" you can give a note a name that you can later use for selecting it in a macro.
-You could definintely select the note with a macro if you know what text it contained.
-Using layers as CorBlimeyLimey suggested above is the way I've seen this handled before...but once the more inquisitive Users figure that out, this is the easiest (of the methods mentioned above) for them to get around. But then again, at least one of them will always find a work-around. We They can be very ingenious.

Answer for (2)
-Absolutely

Ken
 
It is certainly possible to name a note via a macro for later retrieval. I've done it. Save and SaveAs are similarly simple.

It would also be possible, although roundabout, to enable/disable through SW Explorer... sort of. Really it would just move the note off the sheet printable space. However, you would have to use two custom properties working together. The following method assumes that you want to control visibility of this note through the drawing's custom properties and not the model's, although it would pretty much work just the same for model custom props.

First, create the note as you want it, including the links to the custom properties for <drawn> and <date>, whatever those are named. Then, at the very beginning of the note, add a link to a custom property called "SpaceToggle".

Now add two custom properties - One called "SpaceToggle" and one called "Spaces". For the value of "SpaceToggle", enter:

$PRP:"Spaces"

for the value of "Spaces", just put in enough spaces to move the note off the screen. When SW generates the final note text, it will actually evaluate the $PRP link contained in SpaceToggle and insert the value of "Spaces" into the note.

Now, when you want to show the note, you can edit the custom properties (either in SW or SW Explorer) and change the value of "SpaceToggle" to $PRP:"noSpaces". Then when SW tries to evaluate the note, it will not find any property called "noSpaces" so the spaces will not be stuck into the note.

Of course, there's nothing special about the names of the properties. You can call them whatever you want.


-handleman, CSWP (The new, easy test)
 
Sure - but not without SW being open. I can certainly understand wanting to be able to toggle this note without opening the file - especially if the drawing is a large assembly drawing. Even with SW in the background it will take a lot of time to do.

Here's code to toggle a given layer on or off. Very small and sloppy mod to something I posted way back. Just enter the name of the layer you're interested in quotes in the Const LAYERNAME.... line.

Code:
Const COLORQUERY As Boolean = False
Const LAYERNAME As String = "Enter layer name here"

Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim swDwg As SldWorks.DrawingDoc
Dim swLyrMgr As SldWorks.LayerMgr
Dim swLayer As SldWorks.Layer


Sub LayerColorChange()
Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc

If swDocDRAWING <> swDoc.GetType Then
    MsgBox "This only works for drawings"
    Exit Sub
End If

Set swDwg = swDoc

Set swLyrMgr = swDoc.GetLayerManager

If COLORQUERY Then
    Set swLayer = swLyrMgr.GetLayer(swLyrMgr.GetCurrentLayer)
    MsgBox "The color of layer " & swLayer.Name & " is " & swLayer.Color
    Exit Sub
End If

''''''''''''
'copy and paste this block until you have as many as you want
Set swLayer = swLyrMgr.GetLayer(LAYERNAME) 
'swLayer.Color = 255  'Type the number for the desired color here.
''''''''''''
If swLayer.Visible = False Then
    swLayer.Visible = True
Else
    swLayer.Visible = False
End If

End Sub

-handleman, CSWP (The new, easy test)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor