Aeroanion / Free-Solidworks-OBJ-Exporter

A macro to export Solidworks models as .obj files, including .mtl files.
32 stars 5 forks source link

runtime error 91 #16

Open Mannshoch opened 4 years ago

Mannshoch commented 4 years ago

Got a runtime error 91

Private Function getFaceMaterial(sldFace As Object) As String

    getFaceMaterial = convArrayToStr(sldFace.MaterialPropertyValues)

    Dim getFaceTexture As SldWorks.texture 'look for textures on faces

    Dim configName As String

    Dim strTexPath As String, strTex As String, strScFact As String, saveTexPath As String

    Dim bfaceName As String, savebFaceName As String

    Dim featureName As String, saveFeatureName As String

    Set getFaceTexture = sldFace.GetTexture(configName)

    If Not getFaceTexture Is Nothing Then

        strTexPath = getFaceTexture.MaterialName

        saveTexPath = collectTexPaths(strTexPath)

        strTex = getTextureName(strTexPath)
 ➡       strScFact = getFaceTexture.ScaleFactor
        'Print #3, strTex, "fc"

    Else

        strTex = ""

        strScFact = ""

    End If

    If Not getFaceMaterial = "" Then 'face's body name for reference name

        bfaceName = sldFace.GetBody.Name & " face" '& " fcn"

        savebFaceName = collectReferNa
Aeroanion commented 4 years ago

@Mannshoch , thank you for adding this issue. So far, I haven't been able re-produce the problem. Can you let me know what version of Solidworks you are using and the settings that you selected when you hit the "RUN EXPORTER" button? Also, confirm that you are using the .swp file from the version 2.1 release. Thanks!

Mannshoch commented 4 years ago

I'm not able to download 2.1. If I download it here and start it in Solidworks 2020 SP4 the Makro show me 2.0 grafik

Aeroanion commented 4 years ago

Thanks for the reply. The "v2.0" label at the top is a mistake. It should be "v2.1", so it looks like you do have v2.1. I still have not been able to reproduce the issue. It might have something to do with the particular model you are trying to export. Without the model, I am not sure that I will be able to duplicate the issue, but I will keep this in mind and update here if I do find anything.

Mannshoch commented 4 years ago

If I could help you somehow I will do it. Do you see a possibility to use it e.g. with Solidworks Taskscheduler so I may could create an OBJ from every part and assembly? so I'm may find out where in this assembly this error appears first time. Than I may could send you this specific part or subassembly.

Aeroanion commented 4 years ago

@Mannshoch , when you get a chance, download the macro from the issue16 branch that I made today. I turned on the debugging log file. Run the macro on the assembly that gave you the error (I think the macro in this branch will only work on assemblies without errors, not parts). It will create a log file in the assembly's directory, where it makes the OBJ directory. See what the log file says, if should be a list of the parts in the assembly. If so, I think the last part listed is the one with the issue.

Mannshoch commented 4 years ago

00-2020 - Haus am Berg_debugLog.log

Mannshoch commented 4 years ago

I tested this script on the last assembly in this log. 2020 - Esstisch-Wohnen It seems It's not the cause assembly of this error.

Aeroanion commented 4 years ago

Thanks for trying that. This is still a mystery to me. How many assemblies or parts are in the main assembly? I'm wondering if its getting to the end of the memory for a container, or something like that.

Mannshoch commented 4 years ago

grafik

I have 32GB Ram if I run your Makro I don't see any huge change in the RAM usage. The only thing I recognize that your makro do not give any Progressbar or such kind of feedback. Solidworks is simply blocked and could not accessed until the script finish (#18 ).

KySpace commented 1 year ago

Having the same error here

TreeRex77 commented 1 week ago

I solved the issue for me. dont know a lot about code, but it seems that when the error appears, In the underlined line, it shows "strScFact = getFaceTexture.ScaleFactor". But if you notice, in that block, the material was intended to be defined, meaning it would use "feature". By changing this line to "strScFact = getFeatureTexture.ScaleFactor", it works perfectly for me.