[API] - Ask the user to do an action in SW (select a face for example)

Hello

 

I have a macro that exports indiduated parts in a CSV in DXF.

For Volume parts, I only export the annotation view called "DXF". Thus:

bRet = swPart.ExportToDWG2(dxfFilePath, filePath, swExportToDWG_ExportAnnotationViews, True, varAlignment, False, False, 0, varViews)
                                        If bRet Then
                                            debugNlog ("On a exporté la pièce de volumique en DXF:  " & dxfFilePath)
                                        Else
                                            logStatus = debugNlog("ERREUR DXF Volumique: La pièce " & dxfFilePath & "   Config = " & sConfigName & " n'a pas été exporté", "error")
                                            logStatus = debugNlog(filePath, "error")
                                            swApp.SendMsgToUser2 "ERREUR DXF Volumique: La pièce " & docTitle & " n'a pas été exporté" & vbCrLf & "Créez une vue nommée DXF pour corriger le problème", swMbWarning, swMbOk
                                        

 

I would like the macro to pause and the user to be able to create the view while the part is open (click on a face, then click on a macro button that triggers the creation of an annotation view called DXF), then the macro tries the export again, since this time it will be OK it moves on to the next room until it falls back on a room that doesn't have this view and the same, the user creates it live.

(I intend of course to make the choice at launch to know if you should ask the user, or be in "silent" mode to be able to leave your workstation without it blocking the processing.

 

Do you have a technique to give the user back the hand in SW and then click on a "continue/resume" button?

 

Thank you in advance

Try this.


exporter.zip
1 Like

Hello

A little reading HERE to allow you to pause your macro.

On the other hand, why would you want to do this in 2 macros? Isn't it better to check if your DXF view exists and then set a condition to direct your processing to a function to create this DXF view if it doesn't exist before continuing to your DXF export function. You just have to pause at the beginning of the DXF view creation function by asking the user to select the face.

Kind regards

1 Like

Thank you d.roger, I suspected that you would be good advice.

Yes of course I have two macros at the moment but I intend to do it as you recommend!

Yours truly,