AssembyDocClass inheritance

Discussion in 'SolidWorks' started by e7r3m, Aug 25, 2006.

  1. e7r3m

    e7r3m Guest

    Hi.
    i,'m workig with solidworks 2006 api. I have builded a dll library for
    my application that use solidworks api procedurally (using c#
    language)... Now i want to rewrite this library using the object
    paradigm. First i have wrote a class XXX that inherits AssembyDocClass.
    Well... but how can I instantiate my XXX class?

    If i need to instantiate an AssembyDoc procedurally i can use:

    SldWorks.SldWorks sw = new SldWorks.SldWorks();
    AssemblyDoc ad = sw.NewAssembly()

    But how can i instantiate the XXX base class AssemblyDocClass?

    internal class XXX : AssemblyDocClass
    {
    public XXX () : base() <-------------- ????
    {}
    }

    best regards
    e7r3m
     
    e7r3m, Aug 25, 2006
    #1
  2. e7r3m

    Heikki Leivo Guest

    You just cannot. If the base class does not have a public constructor, there
    is no sense at all in inheriting a such class. If SW should use your
    inherited class instead of it's own, how could _it_ know to instantiate the
    inherited class? It would require some kind of factory pattern or callback
    function.

    If a class does not have a public constructor, it is most propably
    intentional. It may even be - and I believe so - that the AssemblyDoc class
    is just an interface or proxy class, and the very internals of SolidWorks
    are much more complicated.

    To solve the problem, write a wrapper class instead of inherited one.

    -h-
     
    Heikki Leivo, Aug 25, 2006
    #2
  3. e7r3m

    e7r3m Guest

    You just cannot. If the base class does not have a public constructor, there
    Thank you for answering.
    Effectively the AssemblyDocClass object that i'm getting is an object
    that .NET interop has generated based on the interfaces in the
    sldworks.tlb type library. The only object that is createtable is the
    SldWorksClass.

    Regards.
    Efrem
     
    e7r3m, Aug 25, 2006
    #3
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.