Exemplo 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);
        }
Exemplo n.º 2
0
 public void UninitializeTransCAD()
 {
     tApp      = null;
     tDocs     = null;
     tPartDoc  = null;
     tPart     = null;
     tAssemDoc = null;
     tFeatures = null;
 }
Exemplo n.º 3
0
 public void UninitializeTransCAD()
 {
     tApp         = null;
     tDocs        = null;
     tAssemDoc    = null;
     tAssem       = null;
     tComp        = null;
     tConstraints = null;
 }
Exemplo n.º 4
0
        //// TransCAD 관련 함수
        public bool InitializeTransCAD(int mode)
        {
            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;


            if (mode == 0) //assembly Pre 일때 사용
            {
                tAssemDoc = tDocs.AddAssemDocument();
            }
            else if (mode == 1) //assembly Post 일때 사용
            {
                tAssemDoc = (TransCAD.AssemDocument)tApp.ActiveDocument;
            }
            //_spAssemDoc = g_spApplication->ActiveDocument; C++

            /* 어셈블리 구조 추가 코드 Preprossor 일때 보통 적용할 수 잇을뜻.
             * tAssemDoc = tDocs.AddAssemDocument();
             * TransCAD.Assem tAssem = tAssemDoc.Assem;
             * TransCAD.Component tComp = tAssem.CreateComponent();
             * tComp.set_Name("Comp1");
             *
             * tPart = tAssem.CreatePart();
             * tPart.set_Name("Part1");
             *
             * tComp.AddPart(tPart);
             * tAssem.AddComponent(tComp);
             */


            //if (ReferenceManager == null)
            //    ReferenceManager = new Reference(this);

            //tAssemDoc.Update();

            return(true);
        }
Exemplo n.º 5
0
        ////

        //// TransCAD 관련 함수
        public bool InitializeTransCAD(int mode)
        {
            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;

            if (mode == 0)  //pre일때 사용 PartDocument 추가
            {
                tPartDoc = tDocs.AddPartDocument();
            }
            else if (mode == 1) //post일때 사용 이미 열려있는 것을 Active
            {
                tPartDoc = (TransCAD.PartDocument)tApp.ActiveDocument;
            }
            else if (mode == 2) //Assembly document에서 part 번역을 위한 initialization
            {
                tAssemDoc         = (TransCAD.AssemDocument)tApp.ActiveDocument;
                isSubAssemblyPart = true;
                return(true);
            }



            tApp.Visible = true;

            tPart     = tPartDoc.Part;
            tFeatures = tPart.Features;

            if (ReferenceManager == null)
            {
                ReferenceManager = new Reference(this);
            }

            //tAssemDoc.Update();

            return(true);
        }
Exemplo n.º 6
0
        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);
            }

            tApp.Visible = true;
            return(true);
        }