Saved File Verification Macro

Hello

I'm working on a macro that allows us to create a drawing sheet for the creation of DXF according to our internal needs, and if the bulk of the code works, it bugs if the drawing has not been previously saved.
So my question is the following: how can we check that the file is already saved?

Thank you for your help

Hello
I'm assuming you're using the file name as a starting point;
It is therefore necessary to monitor the file registration path which is empty if it is not saved with the line below (to be adapted according to variable declarations):

If Part.GetPathName = "" Then
 xxxx 'Taper le traitement souhaité à ce niveau (msgbox ou autre)
End if
3 Likes

Hello @Cyril.f and thank you for your feedback.
So I know how to define that my drawing is not saved, that's a first point. :slight_smile:
now: how can I retrieve the path of the 3D part used for this drawing (in order to retrieve information, and to make the recording of the MeP)
Thank you very much

Re
Something like that:

Dim swModelDocExt   As ModelDocExtension
Dim swCustProp      As CustomPropertyManager

Set swView = swDraw.GetFirstView
Set swView = swView.GetNextView
Set swModel = swView.ReferencedDocument 'Récupère le fichier 3D lié à la vue
Set swModelDocExt = swModel.Extension
Set swCustProp = swModelDocExt.CustomPropertyManager("") 'Accède aux propriétés personnalisées  du fichier

4 Likes

oh great
That's what we needed :slight_smile:
Thank you very much!!!

1 Like