Validation of SmartProperties

I closed the old topic too quickly...

My macro launches the SmartProperties on each of the Welded Items folders.

I used the macro of axemble "SmartProperties 2013-Auto.swp", which automatically validates it.

How do I "wait" in the macro for the user to validate each Smart himself before moving on to the next one?

This line does launch the SmartProperties, but the macro does not have the validation of it to continue...

1 Like

If the macro isn't too long, can you paste it here?

And indicate when you would like the break?

Here is the macro part concerned:

 

    Set swapp = Application.SldWorks
    Set swModel = swapp. ActiveDoc

    On Error Resume Next
    ToolbarId=59427
    If swModel Is Nothing Then
        MsgBox ("No active document")
        End
    Else
        Dim stPathMacro As String
        stPathMacro = swapp. GetCurrentMacroPathName
        strRegFileName = Replace(stPathMacro, ".swp", ".dll")
        strDllFileName = strRegFileName
              
        lStatus = swapp. LoadAddIn(strDllFileName)
        Set swDCAddIn = swapp. GetAddInObject("{5E333A56-A5B6-4a90-B365-BEF36FE5D81C}")
        swDCAddIn.ToolbarCallback0

HERE
        Counter = Counter + 1
       
    End If

 

 

Before the ICI, the smart starts, but the macro continues (counter, then more...)

1 Like

And what do you want to expect?

There is DoEvents that allows you to wait for an action from the user:

http://social.msdn.microsoft.com/Forums/en-US/0398e15d-717b-49eb-b093-62cd0acdf00b/wait-for-event-in-visual-basic-2010

 

Or for a given time, you can loop on a DoEvents to "keep" your code active as in the solution I proposed here (page 2):

 

http://www.lynkoa.com/forum/3d/aucun-acces-solidworks-lors-de-l-execution-de-ma-macro-avec-un-bouton?page=1

 

   For Y = 1 TB 50000
            DoEvents
        Next Y

 

Or 50000 represents 5 seconds.

Hello

 

I think that the best would be to launch a macro that would launch SmartProperties on the first Article and then a new macro would be launched via the SmartProperties which would relaunch SmartProperties on the next Article

The second macro will be launched with the type "Executed" and with the setting "After closing SmartProperties".

 

To find out which mechanic folder SmartProperties has been applied to, either fill in the information in a document property or retrieve the selected item in SolidWorks

 

 

6 Likes

@Lucas: I want to wait for the user to "Validate" the SmartProperties of Article1 before moving on to the next one.

DoEvents may be a solution, but I don't really see how to use it...

 

@Prossignol: the idea is not bad, but difficult to implement. Because the "Next article" macro doesn't work anymore in this case. Everything would have to be started from scratch. But I'll keep the idea if ever.

1 Like

Successful with the DoEvents and the macro at the end of Smart!

 

    ValidCounter = False
SMARTPROPERTIES
    While CounterValid<> True
       DoEvents
    Wend

 

 


Macro to run at the end of smart.
___________________________
    Public Sub execute()
       ValidCounter = True
    End Sub

 

Thanks guys

1 Like