Esempio n. 1
0
        //// TransCAD 관련 함수
        public bool InitializeTransCAD()
        {
            try
            {
                tApp = (TransCAD.Application)Marshal.GetActiveObject("TransCAD.Application");
            }
            catch
            {
                tApp = (TransCAD.Application)Activator.CreateInstance(Type.GetTypeFromProgID("TransCAD.Application"));
            }
            if (tApp == null)
            {
                return(false);
            }

            tDocs     = tApp.Documents;
            tAssemDoc = tDocs.AddAssemDocument();
            tAssem    = tAssemDoc.Assem;

            tComp = tAssem.CreateComponent();
            tComp.set_Name("Components1");

            tAssem.AddComponent(tComp);
            tConstraints = tAssem.Constraints;

            tApp.Visible = true;
            return(true);
        }
Esempio n. 2
0
 public void UninitializeTransCAD()
 {
     tApp         = null;
     tDocs        = null;
     tAssemDoc    = null;
     tAssem       = null;
     tComp        = null;
     tConstraints = null;
 }
Esempio n. 3
0
        public void loadAssemblyInfo()
        {
            tAssemDoc = (TransCAD.AssemDocument)tApp.ActiveDocument;
            tAssem    = tAssemDoc.Assem;
            //Count Component Number
            compCount = tAssem.GetSize();
            compName  = new string[compCount];
            for (int i = 0; i < compCount; i++)
            {
                TransCAD.Component tComp = tAssem.GetComponent(i);
                compName[i] = tComp.get_Name();
                Console.WriteLine("Name of Component[ " + i + " ] : " + tComp.get_Name());

                //Count Part Number in Component
                partCount = tComp.GetSize();
                partname  = new string[partCount];
                if (compName[i] == "Default SubAssembly")
                {
                    continue;
                }
                tcad_PartList = new TransCAD.Part[partCount];
                partFileName  = new string[partCount];
                NXObject[] nxGeom = new NXObject[partCount];
                for (int j = 0; j < partCount; j++)
                {
                    TransCAD.Part tPart = tComp.GetPart(j);
                    partname[j]      = tPart.Name;
                    tcad_PartList[j] = tPart;
                    int    facecount = tPart.Solid.Faces.Count;
                    string facenm    = tPart.Solid.Faces[1].Name;
                    Console.WriteLine(facenm);
                    Console.WriteLine(" Name of Part[ " + j + " ] : " + tPart.Name);
                    partFileName[j] = tPart.Name;
                }
            }
        }