logo资料库

Addin开发学习笔记(一).docx

第1页 / 共10页
第2页 / 共10页
第3页 / 共10页
第4页 / 共10页
第5页 / 共10页
第6页 / 共10页
第7页 / 共10页
第8页 / 共10页
资料共10页,剩余部分请下载后查看
目录
1.动态获取精确绘图坐标系,并动态旋转
2.GetElementByID Method
3.SelectElements Method
4.MsdMemberTraverseType Enum
5.选中元素
6 已知Rotation 求绕各个轴的旋转角度
7通过配置变量获取配置变量的值(cel文件路径)
7.1通过配置变量获取配置变量的值(cel文件路径)。
7.2读取Cel文件时变成共享Cel,减小文件大小
8 VS2012(InstallShield2015LimitedEdition)打包程序详解
9 向量相关内容
目录 目录........................................................................................................ 1 1.动态获取精确绘图坐标系,并动态旋转........................................... 2 2.GetElementByID Method......................................................................3 3.SelectElements Method........................................................................4 4.MsdMemberTraverseType Enum.......................................................... 5 5.选中元素..............................................................................................6 6 已知 Rotation 求绕各个轴的旋转角度............................................. 7 7 通过配置变量获取配置变量的值(cel 文件路径).......................... 8 8 VS2012(InstallShield2015LimitedEdition)打包程序详解....... 9 9 向量相关内容...................................................................................10 1
1.动态获取精确绘图坐标系,并动态旋 转 public void Dynamics(ref Point3d Point, BCOM.View View, MsdDrawingMode DrawMode) { 阵变换 Transform3d pUorToMdl; //逆矩阵变换 Matrix3d rMatrix;//默认矩阵 Point3d pntOrigin;//原点的变形后的原点 Matrix3d rotateAboutViewNormalAtOrigin; Point3d pntOrigin1; CellElement elemCell; Matrix3d rotation; //当前精确绘图矩阵 Matrix3d rotation1; //当前精确绘图矩阵的逆矩阵 rotation = app.CommandState.AccuDrawHints.GetRotation(View); rotation1 = app.Matrix3dInverse(rotation); pUorToMdl = app.Transform3dFromMatrix3dAndFixedPoint3d(rotation1,ref pntOrigin); mdlTMatrix_transformPoint(ref m_atPoints[1], ref pUorToMdl);//将所有点都按照逆矩 elems[0] = app.CreateArcElement2(null, pntOrigin, CircleR, CircleR, rotation1, 0, 2 * Math.PI);//画圆时要用逆矩阵 rotateAboutViewNormalAtOrigin = app.Matrix3dFromVectorAndRotationAngle(rotation.RowZ, m_atPoints[1].Y - pntOrigin.Y < 0 ? 2 * Math.PI - aa : aa);//围绕当前坐标系的Z轴旋转 elemCell.Transform(app.Transform3dFromMatrix3dAndFixedPoint3d(rotateAboutViewNorm alAtOrigin, m_atPoints[0])); //围绕当前坐标系的Z轴旋转 } 2
2.GetElementByID Method Returns an Element object that corresponds to the element having the specified ID. 返回对应于具有指定 ID 的元素的 Element 对象。 DesignFile.GetElementByID only finds elements in the default model. In most cases, it is better to use ModelReference.GetElementID. DesignFile.GetElementByID 仅查找默认模型中的元素。 在大多数情况下,最好使用 ModelReference.GetElementID。 3
3.SelectElements Method object.SelectElements [TraverseType] TraverseType Optional. An MsdMemberTraverseType expression. Normally msdMemberTraverseManipulate if the elements will be modified; msdMemberTraverseCopy otherwise 4
4.MsdMemberTraverseType Enum msdMemberTraverseSimple msdMemberTraverseManipulate msdMemberTraverseCopy msdMemberTraverseEnumerate 0 (&H0) Traverses directly contained members and members that are in contained Named Groups (recursively). 1 (&H1) Traverses members according to the member propagation flags. 2 (&H2) Like msdMemberTraverseManipulate, except it also traverses far references. 3 (&H3) Traverses contained Named Groups as elements rather than traversing them. msdMemberTraverseDirectMembers 4 (&H4) Traverses directly contained members only, ignoring contained Named Groups. 5
5.选中元素 mdlSelect_addElement 这 个 函 数 是 把 元 素 放 到 选 择 集 中 并 高 亮 显 示 的 , mdlDisplaySet_addSelectionSet 是把选择集中的元素添加到显示集中,也就是不在选择集中的 元素将被隐藏。mdlDisplaySet_clear 是重新显示所有元素。 6
6 已知 Rotation 求绕各个轴的旋转角 度 We can get euler angles from rotation matrix using following formula. Given a 3×3 rotation matrix The 3 Euler angles are 7
7 通过配置变量获取配置变量的值(cel 文件路径) 7.1 通过配置变量获取配置变量的值(cel 文件路径)。 //=================以下新方法=================================== string celpath = app.ActiveWorkspace.ConfigurationVariableValue("MS_CELPATH"); celpath = celpath + "\\升降机.cel"; df = app.OpenDesignFileForProgram(celpath); //=================以下旧方法=================================== //ss = System.Windows.Forms.Application.StartupPath + "\\mdlapps\\Resources\\升降机 2.cel"; //df = app.OpenDesignFileForProgram(ss); 7.2 读取 Cel 文件时变成共享 Cel,减小文件大小 int cellLength = mr1.GraphicalElementCache.Scan().BuildArrayFromContents().Length; Element[] eles = new Element[cellLength]; eles = mr1.GraphicalElementCache.Scan().BuildArrayFromContents(); Point3d OPoint = app.Point3dFromXYZ(0, 0, 0); eleDengCel = app.CreateSharedCellElement1("KFGW-Deng", ref eles, ref OPoint); 8
分享到:
收藏