Menu ▾ ▴

#337 Solidworks API pass-by-reference

closed-wont-fix
nobody
pythonwin (177)
5
2015-02-27
2007-10-25
Joe Foley
No

When you run makepy on the SolidWorks api, it gets confused on any of the methods that use pass-by reference. In particular, to anyone trying to do automation using OpenDoc6 runs into the problem of the errors and warnings arguments which are pass-by reference being considered non-optional, even though they are return values.

A fairly in-depth discussion and possible workarounds can be found at: http://ephemeralvalue.com/?p=16
and http://mail.python.org/pipermail/python-list/2002-December/175880.html

Is there a way to make makepy not get confused on these methods, or is this just a function of the SolidWorks API?

Discussion

  • Mark Hammond

    Mark Hammond - 2008-04-06

    Logged In: YES
    user_id=14198
    Originator: NO

    The solution would seem to be to call the function like:

    model, errors, warnings = sw.OpenDoc6( 'cube.sldprt', constants.swDocPART, constants.swOpenDocOptions_Silent, '', pythoncom.Missing, pythoncom.Missing )

    ?

    Please reopen this if I'm missing something. Sadly, I can't change the defaults as that would cause many other things to break...

     
  • Mark Hammond

    Mark Hammond - 2008-04-06
    • status: open --> closed-wont-fix