Got import diagnostic to work where it is not supposed to?

Programming and macros
User avatar
mp3-250
Posts: 630
Joined: Tue Sep 28, 2021 4:09 am
Answers: 20
Location: Japan
x 704
x 347

Got import diagnostic to work where it is not supposed to?

Unread post by mp3-250 »

It seems a limitation of import diagnostic that once a faulty STEP (or other intermediate file) is imported into Solidworks and a solid feature or surface features is added at the bottom of its tree the import diagnostic is no more available to be run from the RMB menu.

So I tried to manually roll back just after the initially imported bodies and used a macro to launch import diagnostics anyway on the imported solids. Boom: the file was fixed. I confirmed it comparing before and after data and deleting the feature added after the import solids from the 3d conversion.

Code: Select all

Dim instance As IPartDoc
Dim value As System.Integer
 
value = instance.ImportDiagnosis(False, False, True)
Parameters
CloseAllGaps : True to repair any gaps, false to not
RemoveFaces : True to remove any bad faces and create gaps in the feature, false to not
FixFaces: True to fix the bad faces, false to not

Options
Not used

Return Value
>= 0 if import diagnosis is successful, -1 if an error occurred
Notes:
we use only fix faces set to true. we are using some floating surface for our internal workflow and if we try to use other flags the diagnostic is going to try to sew them to the solidw body failing the feature.

Unless the diagnostic fails (never been able to make it fail) it renturned 1 everytime even with flags set to false.
I do not think is possible to use ImportDiagnosis to log problematic data. i.e. read only to "scan" the file and output the diagnostic results.

From KB
Question
What is the difference between Entity Check and Import Diagnostics?

Answer
Entity check is used to check an entity's conformity with the currently constructed model shape, and detects errors in the entity overall.
Import Diagnostics performs a geometry check on imported bodies using an entity check, and also detects topology (boundary) errors by checking for surface superposition etc.

Keywords S-069094,1-3SSZGSW
User avatar
bnemec
Posts: 1944
Joined: Tue Mar 09, 2021 9:22 am
Answers: 10
Location: Wisconsin USA
x 2548
x 1400

Re: Got import diagnostic to work where it is not supposed to?

Unread post by bnemec »

This is kinda nice. I've ran into this before where I wanted to run it after making an edit and I didn't want to have to delete the edits.

Going out on a limb here, but I wonder if that was allowed in the past but the corrections from import diagnostic would sometimes break down stream features; as would be expected if the geometry had dependencies in those down stream features. So the solution was to not allow import diag if there are any features.
User avatar
mp3-250
Posts: 630
Joined: Tue Sep 28, 2021 4:09 am
Answers: 20
Location: Japan
x 704
x 347

Re: Got import diagnostic to work where it is not supposed to?

Unread post by mp3-250 »

My group is administering the 3d data and we had plenty of topology errors in our legacy imported 3D models for catalog parts.

sometimes you need to make an hole or have some feature downstream and having to remade them is annoying as you need to fix the mates in their assy as well
even if diagnostic is breaking stuff downstream we are going to fix them anyway and still better to have topology errors or remake the whole thing after delete and diagnose.
User avatar
mp3-250
Posts: 630
Joined: Tue Sep 28, 2021 4:09 am
Answers: 20
Location: Japan
x 704
x 347

Re: Got import diagnostic to work where it is not supposed to?

Unread post by mp3-250 »

Added some notes to the OP.
Be aware that running an entity check do not perform a topology check like the import diagnostic I am forcing with API.
Post Reply