• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

how to switch from imodeldoc2 to iassemblydoc

  • Thread starter Thread starter Mithas
  • Start date Start date

Mithas

Guest
Hello everyone,

someone by chance would know how to cast from imodeldoc2 to iassemblydoc in c# for a solidworks application.

below the part that gives me trouble.

private list<node> children(imodeldoc2 comp)
(')
list<node> date2 = new list<node>(c)
iassemblydoc assy = (iassemblydoc)comp; // here should be the cast, but I always have an error
object object</node></node></node>[] comps = assy.getcomponents(true);
foreach (icomponent2 icomp in comps)
(')
if (!icomp.issuppressed())
data2.add(compinfo(imodeldoc2)icomp.getmodeldoc2());
?
return (list<node>)data2.groupby(x => x.code);
?

I wanted to be able to pass to the method always modeldoc2 and then convert it into iassemblydoc inside, but nothing comes to mind.. .

Thank you.

♪</node>
 
I don't think a cast is possible.

However, you can try using the imodeldocextension interface getdependencies method.
 
I agree with shirokko,
you are getting the imodeldoc2 of the axieme from the component.
 
and your function would look like
Code:
        private list<string> children(imodeldoc2 comp)
        {
            list<string> data2 = new list<string>();
            modeldocextension extension = comp.extension;
            string</string></string></string>[] namesdependence = extension.getdependencies(true, true, true, true);

for (int i = 0; i < namesdependent.length; i++)
(')
data2.add(new dependences[i]);
 }
return data2;
 }
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top