当前位置: 首页>>代码示例>>C#>>正文


C# ModelDoc2.ShowConfiguration2方法代码示例

本文整理汇总了C#中ModelDoc2.ShowConfiguration2方法的典型用法代码示例。如果您正苦于以下问题:C# ModelDoc2.ShowConfiguration2方法的具体用法?C# ModelDoc2.ShowConfiguration2怎么用?C# ModelDoc2.ShowConfiguration2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModelDoc2的用法示例。


在下文中一共展示了ModelDoc2.ShowConfiguration2方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: URDFExporterPM

        //The following runs when a new instance of the class is created
        public URDFExporterPM(SldWorks swAppPtr)
        {
            swApp = swAppPtr;
            ActiveSWModel = swApp.ActiveDoc;
            Exporter = new URDFExporter(swApp);
            Exporter.mRobot = new robot();
            Exporter.mRobot.name = ActiveSWModel.GetTitle();

            linksToVisit = new List<link>();
            docMenu = new ContextMenuStrip();

            string PageTitle = null;
            string caption = null;
            string tip = null;
            long options = 0;
            int longerrors = 0;
            int controlType = 0;
            int alignment = 0;
            string[] listItems = new string[4];

            ActiveSWModel.ShowConfiguration2("URDF Export");

            #region Create and instantiate components of PM page
            //Set the variables for the page
            PageTitle = "URDF Exporter";
            //options = (int)swPropertyManagerButtonTypes_e.swPropertyManager_OkayButton + (int)swPropertyManagerButtonTypes_e.swPropertyManager_CancelButton + (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_LockedPage + (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_PushpinButton;
            options = (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_OkayButton + (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_CancelButton + (int)swPropertyManagerPageOptions_e.swPropertyManagerOptions_HandleKeystrokes;

            //Create the PropertyManager page
            pm_Page = (PropertyManagerPage2)swApp.CreatePropertyManagerPage(PageTitle, (int)options, this, ref longerrors);

            //Make sure that the page was created properly
            if (longerrors == (int)swPropertyManagerPageStatus_e.swPropertyManagerPage_Okay)
            {
                setupPropertyManagerPage(ref caption, ref tip, ref options, ref controlType, ref alignment);
            }

            else
            {
                //If the page is not created
                System.Windows.Forms.MessageBox.Show("An error occurred while attempting to create the " + "PropertyManager Page");
            }

            #endregion
        }
开发者ID:chlai,项目名称:sw2urdf,代码行数:46,代码来源:URDFExporterPM.cs

示例2: RobotModel

        /// <summary>
        /// Loads a robot from an assembly document, if a robot dosn't already
        /// exist one will be created
        /// </summary>
        /// <param name="asm">Assembly document containing a robot model</param>
        /// <param name="swApp">Interface for interacting with Solidworks</param>
        public RobotModel(AssemblyDoc asm, SldWorks swApp)
        {
            RobotInfo.WriteToLogFile("Robot Created (Robot)");

            var assembly = typeof(JointSpecifics).Assembly;
            Type[] types = assembly.GetTypes().Where(
                t => t.IsSubclassOf(typeof(JointSpecifics)) && !t.IsAbstract).ToArray();
            foreach (Type t in types)
            {
                System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(t.TypeHandle);
            }
            RobotInfo.WriteToLogFile("Initialized JointTypes = " + String.Join(", ",JointFactory.GetTypesList()) + " (Robot)");

            //Setup fields
            this.swApp = swApp;
            this.asmDoc = asm;
            this.modelDoc = (ModelDoc2)asm;
            swData = new StorageModel(modelDoc);
            Selected = false;

            RobotInfo.SetProperties(swApp, asmDoc, swData, this);
            RobotInfo.WriteToLogFile("Setup Fields Setup");
            //If the robot data dosn't exist yet, create it with default values
            if (swData.GetDouble("robot") == 0)
            {
                swData.SetDouble("robot", 1);
                /*PhysicalConfig = "Default";
                VisualConfig = "Default";
                CollisionConfig = "Default";*/
                Name = ((ModelDoc2)asm).GetTitle();
                RobotInfo.WriteToLogFile("Robot Data created with Default Values");
            }

            RobotInfo.WriteToLogFile("Robot Data created");

            LinkNums = new DoubleStorageArray(swData, "robot/linkNums");
            nextLinkNum = 0;
            RobotInfo.WriteToLogFile("LinkNums Storage Array Created");

            Links = new Dictionary<int,Link>();
            //Load link structure
            Link newLink;
            if (LinkNums.Count == 0)
            {
                LinkNums.AddItem(0);
                RobotInfo.WriteToLogFile("New Link added to LinkNums");
            }

            Configuration currentConfig = modelDoc.ConfigurationManager.ActiveConfiguration;

            foreach (double d in LinkNums)
            {
                newLink = new Link("robot/link" + (int)d, (int)d);
                RobotInfo.WriteToLogFile("New Link Created");
                Links.Add((int)d,newLink);
                if (d >= nextLinkNum)
                    nextLinkNum = (int)d + 1;
            }
            Links[0].isBaseLink = true;

            foreach (Link l in Links.Values.ToArray())
            {
                l.InitializeJoints();
                l.InitializeAttachments();
            }
            modelDoc.ShowConfiguration2(ConfigName);
            CalcAxisVectors();
            CalcOrigin();

            modelDoc.ShowConfiguration2(currentConfig.Name);
        }
开发者ID:FRCTeam159,项目名称:MentorRepository,代码行数:77,代码来源:Robot.cs


注:本文中的ModelDoc2.ShowConfiguration2方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。