What is the main goal of this macro:
Display a watermark on a SLDRW related to the PDMW status(lifecycle) of the drawing
General idea:
I'm trying to tweakMatthewLorono Watermark method to do the following:
Having the Watermark custom properties in the SLDRW switch betweenthe"SPACE" and "FOR QUOTE" depending on which status the PDMW hasuploaded under the "STATUS" custom properties field.
This macro must "be in loop" since i dont want the user to care ofit while he's working.
I want this macro to be launched on solidworks start up
How to achieve this as i imagine it:
Launching the macro with the solidworks icon
Having the Macro run in loop in back ground with a timer to avoidthe computer to lock up... ( will this work???? any other idea fora constant macro action?)
What's wrong actually:
I'm a low experienced coding user and this is berond my capacity.Property edit not working.
Not wise enough to insert a timer in my code. Maybe coding theMacro to activate every time a file is open would be better....???
How the hell do i launch a VB script on SW start up??
As you may see i have a lot of idea but need input to complete eachof them. I would be happy and open to have everyone contribution tocomplete this macro.
I'm leaving on vacation for 2 weeks so i'll try to check as much aspossible this thread from home to grab your comments on all this.
Thanks for everyone input whoever want to share there codingexperiences.
Here is what i've done so far:
Dim swApp As SldWorks.SldWorks
Dim CurrentDoc As SldWorks.ModelDoc2
Dim cusPropMgr As SldWorks.CustomPropertyManager
Dim Watermark As String
Dim Status As String
Dim Repeat As String
Dim t
Sub Main()
Repeat = 1
Do
t = 0
'"timedCount()" function needing ot be written
Set swApp = Application.SldWorks
Set CurrentDoc = swApp.ActiveDoc
Set cusPropMgr = CurrentDoc.Extension.CustomPropertyManager("")
Status = cusPropMgr.Get("Status")
LenStatus = Len(Status)
If LenDescr > 0 Then
Watermark = cusPropMgr.Set("Watermark", " ")
Else
If Status = Conception Then
Watermark = cusPropMgr.Set("Watermark", "FOR QUOTE")
End If
If Status = Approbation Then
Watermark = cusPropMgr.Set("Watermark", "FOR QUOTE")
End If
If Status = Modification Then
Watermark = cusPropMgr.Set("Watermark", "FOR QUOTE")
End If
If Status = Approuvé Then
Watermark = cusPropMgr.Set("Watermark", " ")
End If
End If
Loop While Repeat = 1 And t = 5
End Sub
SébastienSolidworksApi macros