Hola all
I'm putting together a macro that takes excel data and creates parts from a library of templates.
For the most part things are working, but I'd like to expand the error reporting somehow. I am logging errors I can predict (zero conditions, template not found, etc), but I'd like to be able to record & report errors that Solidworks has during modeling and drawing phases. I know there are a few conditions where the part gets made but for instance a sketch will have an error because of a dimension problem but the Part will save fine. But I'd like to know about those errors sooner rather than later because they mean bad input data that I don't currently have a filter for.
Parts are created with the swApp.NewDocument method using a Template name variable.
I'm not even sure what to search for in the API reference for modeling error flags. Any help would be appreciated in this!
Thanks
M
recording errors in API generated Parts
Re: recording errors in API generated Parts
See Feature::GetErrorCode2 in the API help.
Re: recording errors in API generated Parts
Okay cool, so for each generated part I'd go through all the features in the tree to check for errors using GetErrorCode2
Let me give it at try!
Thanks!
Re: recording errors in API generated Parts
Additionally, you can access the "What's Wrong" dialog information by using IModelDocExtension.GetWhatsWrong(). It will output an array of problematic features, and array of error codes, and an array of warnings.
https://help.solidworks.com/2023/englis ... Wrong.html
I have this running in one of my apps to check for rebuild errors. Compared to the SW window:
https://help.solidworks.com/2023/englis ... Wrong.html
I have this running in one of my apps to check for rebuild errors. Compared to the SW window:
Re: recording errors in API generated Parts
Thanks all for the replies on this. I haven't had a chance to try implementing these ideas yet, but I appreciate the input. Will follow up when I get up for some air.
M
M