Unknown File format for .sldprt file - Standalone Batch Program

Hi Guys,

I have written a standalone batch script in VB.net that Checkin the .sldprt file to 3DExperience (As I have 3DExperience connector as PDM installed). When I select the file from Enoserver.BrowseforFile() API, I get this error.

Code:

 newSelection = server.BrowseForFile(Me.Handle.ToInt32,

                                            EnoBrowseFlag.EnoBws_ForOpen + EnoBrowseFlag.EnoBws_PermitMultipleSel + EnoBrowseFlag.EnoBws_PermitLocalFiles + EnoBrowseFlag.EnoBws_PermitVaultFiles,

                                            "(*.sldprt; *.sldasm; *.slddrw)|*.sldprt;*.sldasm;*.slddrw|All Files (*.*)|*.*||", "",

                                            "", server.RootFolderPath, "Select Files to CheckIn ")

But when I try to Checkin the same file from windows form (Manual Checkin) or through solidworks application, I donot get this error and CheckIn of file gets executed.

Could some one help me out on what needs to be included in my batch to recognize the .sldprt file.

‌ ‌ ‌ ‌

Thanks,

SolidworksApi/macros
Comments 13
ES
ES 2021-04-09

 

Yes.. You are right.. Even Browse for file creates selection object, But I intended to create selection object before BrowseForFile. Neverthless, It would be an optimization.

checkin.AddSelection(newSelection) --> added after browse for file and before calling prepare() API.

 newSelection = server.BrowseForFile(Me.Handle.ToInt32,

                                            EnoBrowseFlag.EnoBws_ForOpen + EnoBrowseFlag.EnoBws_PermitMultipleSel + EnoBrowseFlag.EnoBws_PermitLocalFiles + EnoBrowseFlag.EnoBws_PermitVaultFiles,

                                            "(*.SLDPRT; *.SLDASM; *.SLDDRW)|*.SLDPRT;*.SLDASM;*.SLDDRW|All Files (*.*)|*.*||", "",

                                            "", server.RootFolderPath, "Select Files to CheckIn ")

 If newSelection Is Nothing Then Exit Sub

 checkin.AddSelection(newSelection)

 Dim PrepBool As Boolean

        PrepBool = checkin.Prepare(Me.Handle.ToInt32, EnoCheckInBuildTreeFlags.Ecibtf_MayCheckIn)

 

I get the error shown on window after showdlg() API call.. 

When I further proceed with Commit() API, I get "referenced configuration not found" error..

ES
ES 2021-04-09

Hi Frederick,

Yes.. I'm able to see the drop down with " All Files " option.

AT
AT 2021-04-09

Hi,

I'm not exactly sure as I haven't got an experience with 3ds experience platform, but in PDM this error usually comes in case of the future version, i.e. the SOLIDWORKS file you are pushing is of a newer version than your server supports.

Thanks,

Artem

DH
DH 2021-04-09

I have seen this error caused by a configuration name that is too long.  I think the maximum in PDM is 250 characters or so.

ST
ST 2021-04-09

As far as I can see, you haven't shown us the code that does the check in. You have only posted the code which lets you browse for a file. Presumably browsing for the file works OK, but the check in line fails.Can you post that piece of code?

ST
ST 2021-04-09

Sorry - I don't know Enovia at all. But I can't see where the checkin object gets to know about the files that you have selected in server.BrowseForFile.

The equivalent call in SolidWorksPDM has a method called AddSelection where you pass a list of files into it.Just having the files selected wouldn't be enough for it to know which ones you wanted to check in.

ES
ES 2021-04-09

ok.. I add the selection got from the browse file using checkin.addselection().. but after this only, i get the error display on showdlg()..

So, I was wondering how to make my program recognize that it is solid works file, that I'm trying to checkin is the big question.. yet not resolved.. 

FL
FL 2021-04-09

newSelection = server.CreateUtility(EnoObjectType.EnoObj_EnoSelection)

 

newSelection =

server.BrowseForFile( Me.Handle.ToInt32,EnoBrowseFlag.EnoBws_ForOpen +                                        noBrowseFlag.EnoBws_PermitMultipleSel + EnoBrowseFlag.EnoBws_PermitLocalFiles +                                        EnoBrowseFlag.EnoBws_PermitVaultFiles,

                                      "(*.sldprt; *.sldasm;*.slddrw)|*.sldprt;*.sldasm;*.slddrw|All Files (*.*)|*.*||", "","",

                                        server.RootFolderPath, "Select Files to CheckIn ")

You assigned newSelection twice and never used it again.

Any reason?

DH
DH 2021-04-09

Can you check it in manually without the error?  I recently had several files that would throw that error even on manual check in, due to a very long configuration name.  Once I shortened it, no further problems.

ES
ES 2021-04-09

No issues in Manual checkin and works fine.. Unfortunately.. !

ES
ES 2021-04-09

CreateUtility -> for creation of Selection object

BrowseForFile -> to add files into selection object.

checkin.addselection() -> to add selection object to checkin.

FL
FL 2021-04-09

newSelection = server.BrowseForFile

Replaced, overwrite newSelection.

newSelection = server.CreateUtility

Making newSelection = server.CreateUtility useless.

Don't see checkin.addselection() in the code you post.

At which line did you get the error?

FL
FL 2021-04-09

You sure this is correct?

"(*.sldprt; *.sldasm; *.slddrw)|*.sldprt;*.sldasm;*.slddrw|All Files (*.*)|*.*||"