Tutorial to turn Macro into DLL?

Discussion in 'SolidWorks' started by Ant., Mar 29, 2005.

  1. Ant.

    Ant. Guest

    Does anybody have a tutorial for turning a Macro into a DLL?
    Apparently there was one at www.markkulehtola.net but it seems to have
    been removed.
     
    Ant., Mar 29, 2005
    #1
  2. Evan T. Basalik, Mar 29, 2005
    #2
  3. Ant.

    Ant. Guest

    Thanks Evan, but I need something that starts from the beginning and
    describes the process. Any other thoughts?

    Regards,

    Anthony
     
    Ant., Mar 29, 2005
    #3
  4. Ant.

    That70sTick Guest

    <http://www.esoxrepublic.com/devtools/>

    Project to take existng macro and turn it into an addin with toolbars
    and menu picks. Includes macro source, toolbar bitmaps, and other
    resources.

    Pay special attention to how you structure your macro. Do what you can
    to make it "addin ready" (this is discussed in the Powerpoint
    presentation).
     
    That70sTick, Mar 29, 2005
    #4
  5. Ant.

    Ant. Guest

    Thanks Roland. By the way I'm having some trouble with my macro. The
    goal is to start with a drawing, open the associated part, and read out
    some custom properties of the part. For some reason the macro only
    works if you have already opened the part in your current session (even
    if you've since closed it). The offending lines are:

    'Open and activate the referenced Model
    Set swDrawModel = swApp.OpenDoc6(ModelName, DocType,
    swOpenDocOptions_Silent, "", nErrors, nWarnings)
    Set swDrawModel = swApp.ActivateDoc2(ModelName, False, nRetval)
    ClientCode = Trim(swDrawModel.CustomInfo2("", "ClientCode"))

    The error message is "Object variable or with block variable not set",
    and the offending article is 'swDrawModel.CustomInfo2(...'

    Any ideas?
     
    Ant., Mar 29, 2005
    #5
  6. Ant.

    Ant. Guest

    Roland - don't worry, I just debugged it. Apparently you can't use the
    full file path in the ActivateDoc2 command. Substituting a string
    called sModelName (model name only, no directory info) into the
    ActivateDoc2 command got it working.

    Thanks for the Powerpoint, its awesome. Wish I'd been there, as I'm
    not clear on some of the steps. Will post any questions.

    Regards,

    Anthony
     
    Ant., Mar 30, 2005
    #6
  7. Ant.

    That70sTick Guest

    I'm not sure you need to use ActivateDoc2 after opening the document,
    since OpenDoc6 already sets the swDrawModel object to the desired file.
    Maybe do a quick check to verify that the newly opened doc is active
    before activating it (again). The trouble with ActivateDoc2 and the
    path name is puzzling, as it should work with the full path name.

    If you need to be sure the doc is activated, perhaps use
    ModelDoc2::GetTitle or ModelDoc2::GetPathName to get the name string.
     
    That70sTick, Mar 30, 2005
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.