• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ModelDoc2类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: AddModelToList

 internal static void AddModelToList(SwAddin mSwAddin, ModelDoc2 newModel)
 {
     List<ModelDoc2> fM = null;
     string xNameOfAss = mSwAddin.GetXNameForAssembly(false, Path.GetFileNameWithoutExtension(mSwAddin.SwModel.GetPathName()));
     #region Проверка на наличие модели,которая была удалена
     var checkList = new List<ModelDoc2>();
     if (!DictionaryListMdb.ContainsKey(xNameOfAss))
         DictionaryListMdb.Add(xNameOfAss, new List<ModelDoc2>());
     foreach (var m in DictionaryListMdb[xNameOfAss])
     {
         try
         {
             m.GetPathName();
             checkList.Add(m);
         }
         catch (COMException)
         {
             continue;
         }
     }
     #endregion
     if (!checkList.Contains(newModel))
         CheckMdbForDecors(mSwAddin, newModel, checkList, null, fM);
     DictionaryListMdb[xNameOfAss] = checkList;
 }
开发者ID:digger1985,项目名称:MyCode,代码行数:25,代码来源:Decors.cs


示例2: JointAxis

        public JointAxis(SldWorks swApp, AssemblyDoc asm, StorageModel swData, string path, Joint current, int index, RobotModel robot)
        {
            this.swApp = swApp;
            this.asmDoc = asm;
            this.modelDoc = (ModelDoc2)asm;
            this.swData = swData;
            this.path = path;
            this.owner = current;
            this.robot = robot;

            this.AxisIndex = index;

            if (EffortLimit == 0)
            {
                this.EffortLimit = 1;
            }
            if (this.VelocityLimit == 0)
            {
                this.VelocityLimit = 1;
            }

            if (Axis != null)
            {
                CalcAxisVectors();
                //CalcLimits(null);
            }
            if (index == 2)
            {
                IsContinuous = true;
            }
        }
开发者ID:FRCTeam159,项目名称:MentorRepository,代码行数:31,代码来源:JointAxis.cs


示例3: DocumentEventHandler

 public DocumentEventHandler(ModelDoc2 modDoc, SwAddin addin)
 {
     document = modDoc;
     userAddin = addin;
     iSwApp = (ISldWorks)userAddin.SwApp;
     openModelViews = new Hashtable();
 }
开发者ID:drt-ftl,项目名称:VAMEsolidworksPlugin,代码行数:7,代码来源:EventHandling.cs


示例4: frmFullPrice

        public frmFullPrice(ModelDoc2 model)
        {
            InitializeComponent();

            CurrentState = State.ErrorsHide;
            this.model = model;
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:7,代码来源:frmFullPrice.cs.cs


示例5: setRobot

        /// <summary>
        /// Sets the current robot that is linked to this page
        /// </summary>
        /// <param name="robot">robot to be used</param>
        /// <param name="model">model to be used</param>
        public void setRobot(RobotModel robot, ModelDoc2 model)
        {
            this.robot = robot;
            robotName.Text = robot.Name;

            string[] configurations = model.GetConfigurationNames();

            IncludeFRCfieldBox.Visible = PluginSettings.UseFRCsim;
            if (PluginSettings.UseFRCsim)
            {
                switch (robot.FRCfield)
                {
                    case 2014:
                        FRC2014FieldButton.Checked = true;
                        break;
                    case 2015:
                        FRC2015FieldButton.Checked = true;
                        break;
                    default:
                        NoFieldButton.Checked = true;
                        break;
                }
            }
            if (robot.ExportType == 0)
                SDFExportTypeButton.Checked = true;
            else
                URDFExportTypeButton.Checked = true;
        }
开发者ID:FRCTeam159,项目名称:MentorRepository,代码行数:33,代码来源:RobotProperties.cs


示例6: AssemblyEventHandler

 public AssemblyEventHandler(ModelDoc2 modDoc, SwAddin addin)
     : base(modDoc, addin)
 {
     doc = (AssemblyDoc)document;
     swModel = modDoc;
     swAddin = addin;
 }
开发者ID:Compac-Michael,项目名称:CustomProperty,代码行数:7,代码来源:EventHandling.cs


示例7: DocumentEventHandler

 public DocumentEventHandler(ModelDoc2 modDoc, SwAddin addin)
 {
     Document = modDoc;
     UserAddin = addin;
     SwApp = UserAddin.SwApp;
     OpenModelViews = new Hashtable();
 }
开发者ID:digger1985,项目名称:MyCode,代码行数:7,代码来源:EventHandling.cs


示例8: frmCopyProject

 public frmCopyProject(SwAddin swAdd,ISldWorks iswApp,ModelDoc2 rootModel,string openFile)
 {
     _swAdd = swAdd;
     _iswApp = iswApp;
     _swModelDoc = rootModel;
     _openFile = openFile;
     InitializeComponent();
     WarningLabel.Text = string.Empty;
 }
开发者ID:digger1985,项目名称:MyCode,代码行数:9,代码来源:frmCopyProject.cs


示例9: KitchenModule

 public KitchenModule(ModelDoc2 _rootModel, Component2 _swRootComponent, SwAddin _swAddin, ModelDoc2 _swModel)
 {
     RootModel = _rootModel;
     swRootComponent = _swRootComponent;
     measure = RootModel.Extension.CreateMeasure();
     swAddin = _swAddin;
     swModel = _swModel;
     rootName = Path.GetFileNameWithoutExtension(RootModel.GetPathName());
 }
开发者ID:digger1985,项目名称:MyCode,代码行数:9,代码来源:KitchenModule.cs


示例10: FrmReplaceComponents

        public FrmReplaceComponents(SwAddin swAddin, Component2[] selComps)
        {
            InitializeComponent();

            _mSwAddin = swAddin;
            _mSelComps = selComps;
            _swModel = (ModelDoc2)_mSwAddin.SwApp.ActiveDoc;

            Show();
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:10,代码来源:frmReplaceComponents.cs


示例11: showAllComponents

 //Except for an exclusionary list, this shows all the components
 public static void showAllComponents(ModelDoc2 model, List<string> hiddenComponents)
 {
     AssemblyDoc assyDoc = (AssemblyDoc)model;
     List<Component2> componentsToShow = new List<Component2>();
     object[] varComps = assyDoc.GetComponents(false);
     foreach (Component2 comp in varComps)
     {
         if (!hiddenComponents.Contains(comp.Name2))
         {
             componentsToShow.Add(comp);
         }
     }
     showComponents(model, componentsToShow);
 }
开发者ID:chlai,项目名称:sw2urdf,代码行数:15,代码来源:Common.cs


示例12: selectComponents

 //Selects components from a list.
 public static void selectComponents(ModelDoc2 model, List<Component2> components, bool clearSelection = true, int mark = -1)
 {
     if (clearSelection)
     {
         model.ClearSelection2(true);
     }
     SelectionMgr manager = model.SelectionManager;
     SelectData data = manager.CreateSelectData();
     data.Mark = mark;
     foreach (Component2 component in components)
     {
         component.Select4(true, data, false);
     }
 }
开发者ID:chlai,项目名称:sw2urdf,代码行数:15,代码来源:Common.cs


示例13: getSelectedComponents

 //Finds the selected components and returns them, used when pulling the items from the selection box because it would be too hard
 // for SolidWorks to allow you to access the selectionbox components directly.
 public static void getSelectedComponents(ModelDoc2 model, List<Component2> Components, int Mark = -1)
 {
     SelectionMgr selectionManager = model.SelectionManager;
     Components.Clear();
     for (int i = 0; i < selectionManager.GetSelectedObjectCount2(Mark); i++)
     {
         object obj = selectionManager.GetSelectedObject6(i + 1, Mark);
         Component2 comp = (Component2)obj;
         if (comp != null)
         {
             Components.Add(comp);
         }
     }
 }
开发者ID:chlai,项目名称:sw2urdf,代码行数:16,代码来源:Common.cs


示例14: Actualization

        public static void Actualization(ModelDoc2 model, SwAddin _mSwAddin)
        {
            Component2 _swSelectedComponent = model.ConfigurationManager.ActiveConfiguration.GetRootComponent3(true);
            OleDbCommand cm;
            OleDbDataReader rd;
            OleDbConnection oleDb;
            if (!_mSwAddin.OpenModelDatabase(model, out oleDb))
                return;
            cm = new OleDbCommand("SELECT * FROM faners ORDER BY FanerName ", oleDb);
            rd = cm.ExecuteReader();
            List<Faner> faners = new List<Faner>();
            while (rd.Read())
            {
                if (rd["FanerType"] as string != null)
                {
                    faners.Add(new Faner((string)rd["FanerName"], (string)rd["FanerType"], (string)rd["DecorGroup"]));
                }
                else
                {
                    faners.Add(new Faner((string)rd["FanerName"], string.Empty, (string)rd["DecorGroup"]));
                }
            }
            rd.Close();
            Feature feature;
            foreach (var faner in faners)
            {
                string suffix = faner.FanerName.Substring(faner.FanerName.Length - 2, 2);

                feature = FindEdge(_swSelectedComponent, faner.AxFanerName);
                if (feature != null)
                {
                    if (feature.IsSuppressed())
                    {
                        _mSwAddin.SetModelProperty(model, "Faner" + suffix, "", swCustomInfoType_e.swCustomInfoText, string.Empty, true);
                        _mSwAddin.SetModelProperty(model, "colorFaner" + suffix, "", swCustomInfoType_e.swCustomInfoText, string.Empty, true);
                    }
                    else
                    {
                        string fieldValue = model.GetCustomInfoValue(string.Empty, "Faner" + suffix);
                        if (fieldValue == string.Empty)
                        {
                            string msgText = "Для данной детали: " + model.GetPathName() + " кромка Faner" + suffix + " в модели не соответствует свойствам файла сборки. Данная кромка не будет импортирована в программу Покупки! Чтобы исправить эту ошибку используйте опцию \"MrDoors - Отделка кромки\"";
                            MessageBox.Show(msgText, @"MrDoors", MessageBoxButtons.OK);
                        }
                    }
                }
            }
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:48,代码来源:frmEdge.cs


示例15: FrmEdge

        public FrmEdge(SwAddin swAddin)
        {
            InitializeComponent();
            _mSwAddin = swAddin;
            _swModel = (ModelDoc2)_mSwAddin.SwApp.ActiveDoc;
            _swSelMgr = (SelectionMgr)_swModel.SelectionManager;
            _swAsmDoc = (AssemblyDoc)_swModel;
            _swAsmDoc.NewSelectionNotify += NewSelection;

            pbEdge11.Image = null;
            pbEdge12.Image = null;
            pbEdge21.Image = null;
            pbEdge22.Image = null;
            NewSelection();

            Show();
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:17,代码来源:frmEdge.cs


示例16: FrmSetParameters

        public FrmSetParameters(SwAddin swAddin)
        {
            InitializeComponent();
            bitmap = Properties.Resources.Brush;
            tabMain.AutoSize = true;
            KeyDown += FormKeyDown;

            _mSwAddin = swAddin;
            _swModel = (ModelDoc2)_mSwAddin.SwApp.ActiveDoc;
            _swSelMgr = (SelectionMgr)_swModel.SelectionManager;

            _swAsmDoc = (AssemblyDoc)_swModel;
            _swAsmDoc.NewSelectionNotify += NewSelection;
            _swAsmDoc.AddItemNotify += AddNewItem;
            tabMain.Selected += TabMainTabSelected;
            tabMain.SelectedIndexChanged += TabMainSelectedIndexChanged;
            if (!Properties.Settings.Default.SetParentWindow)
                TopMost = true;
            Show();
            NewSelection();
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:21,代码来源:frmSetParameters.cs


示例17: StorageModel

        /// <summary>
        /// Creates a StorageModel for reading and writing data on the given Model
        /// </summary>
        /// <param name="model">Model to read and write data keys from</param>
        public StorageModel(ModelDoc2 model)
        {
            this.model = model;
            data = new Dictionary<string, LinkedList<IAttribute>>();
            //storedDoubles = new Dictionary<string,List<double>>();
            storedObjects = new Dictionary<string,object>();
            //storedStrings = new Dictionary<string,List<string>>();
            Feature feat = model.FirstFeature(); //Start scan of robot attribute's sub-features
            IAttribute attr;
            nextID = 0;
            int id;
            string path;
            int stopindex;
            LinkedList<IAttribute> newlist;

            while (feat != null)  //Scan robot attribute's sub-features
            {
                if (feat.GetTypeName().Equals("Attribute"))
                {
                    attr = (IAttribute)feat.GetSpecificFeature2();
                    if (attr.GetName().StartsWith("gsim"))
                    {
                        stopindex = attr.GetName().IndexOf("_");
                        id = Convert.ToInt32(attr.GetName().Substring(4, stopindex-4));
                        if (id >= nextID)
                            nextID = id + 1;
                        path = ((IParameter)attr.GetParameter("name")).GetStringValue();
                        if (!data.ContainsKey(path))
                        {
                            newlist = new LinkedList<IAttribute>();
                            newlist.AddLast(attr);
                            data.Add(path, newlist);
                        }
                        else
                            data[path].AddLast(attr);
                    }
                }
                feat = feat.GetNextFeature();
            }
        }
开发者ID:FRCTeam159,项目名称:MentorRepository,代码行数:44,代码来源:StorageModel.cs


示例18: createLinkFromPartModel

        // This creates a Link from a Part ModelDoc. It basically just extracts the material properties and saves them to the appropriate fields.
        public link createLinkFromPartModel(ModelDoc2 swModel)
        {
            link Link = new link();
            Link.name = swModel.GetTitle();

            Link.isFixedFrame = false;
            Link.Visual = new visual();
            Link.Inertial = new inertial();
            Link.Collision = new collision();

            //Get link properties from SolidWorks part
            IMassProperty swMass = swModel.Extension.CreateMassProperty();
            Link.Inertial.Mass.value = swMass.Mass;
            double[] moment = swMass.GetMomentOfInertia((int)swMassPropertyMoment_e.swMassPropertyMomentAboutCenterOfMass); // returned as double with values [Lxx, Lxy, Lxz, Lyx, Lyy, Lyz, Lzx, Lzy, Lzz]
            Link.Inertial.Inertia.setMomentMatrix(moment);

            double[] centerOfMass = swMass.CenterOfMass;
            Link.Inertial.Origin.xyz = centerOfMass;
            Link.Inertial.Origin.rpy = new double[3] { 0, 0, 0 };

            // Will this ever not be zeros?
            Link.Visual.Origin.xyz = new double[3] { 0, 0, 0 };
            Link.Visual.Origin.rpy = new double[3] { 0, 0, 0 };
            Link.Collision.Origin.xyz = new double[3] { 0, 0, 0 };
            Link.Collision.Origin.rpy = new double[3] { 0, 0, 0 };

            // [ R, G, B, Ambient, Diffuse, Specular, Shininess, Transparency, Emission ]
            double[] values = swModel.MaterialPropertyValues;
            Link.Visual.Material.Color.Red = values[0];
            Link.Visual.Material.Color.Green = values[1];
            Link.Visual.Material.Color.Blue = values[2];
            Link.Visual.Material.Color.Alpha = 1.0 - values[7];
            Link.Visual.Material.name = "material_" + Link.name;

            return Link;
        }
开发者ID:chlai,项目名称:sw2urdf,代码行数:37,代码来源:URDFExporterExtension.cs


示例19: PartEventHandler

 public PartEventHandler(ModelDoc2 modDoc, SwAddin addin)
     : base(modDoc, addin)
 {
     doc = (PartDoc)document;
 }
开发者ID:Compac-Michael,项目名称:CustomProperty,代码行数:5,代码来源:EventHandling.cs


示例20: DrawingEventHandler

 public DrawingEventHandler(ModelDoc2 modDoc, SwAddin addin)
     : base(modDoc, addin)
 {
     doc = (DrawingDoc)document;
 }
开发者ID:Compac-Michael,项目名称:CustomProperty,代码行数:5,代码来源:EventHandling.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ModelDto类代码示例发布时间:2022-05-24
下一篇:
C# ModelDescriptionGenerator类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap