社区
Inventor 产品技术应用讨论区
欢迎访问欧特克Inventor论坛!分享知识,发帖提问,浏览Inventor热帖
取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

使用AIP通过三个点的XYZ坐标建立工作平面失败

3 条回复3
已解决
回复
1 条消息(共 4 条)
Ruankaixin
551 次查看, 3 条回复

使用AIP通过三个点的XYZ坐标建立工作平面失败

各位大佬,我的需求是创建新零件文档,之后在零件文档内通过三个点的XYZ坐标创建工作平面,之后在此工作平面进行其他操作,但当代码运行到创建工作平面时报错,以下是我的代码,请各位大佬指点。

// 创建一个新的零件文档
PartDocument partDoc = (PartDocument)inventorApp.Documents.Add(
DocumentTypeEnum.kPartDocumentObject,
inventorApp.FileManager.GetTemplateFile(DocumentTypeEnum.kPartDocumentObject), true);
// 获取 ComponentDefinition 对象
PartComponentDefinition compDef = partDoc.ComponentDefinition;
// 获取TransientGeometry对象,用于执行几何操作
TransientGeometry transientGeometry = inventorApp.TransientGeometry;

// 定义3D点
Point EquipCP1 = transientGeometry.CreatePoint(-19.67756345, -14.88854191, -4.6);
Point EquipCP2 = transientGeometry.CreatePoint(-19.67756345, -14.88854191, -5.2);
Point EquipCP3 = transientGeometry.CreatePoint(-19.91632049, -14.56761346, -5.2);

// 创建一个工作平面,通过EquipCP1, EquipCP2, EquipCP3定义的平面

WorkPlane workPlane = compDef.WorkPlanes.AddByThreePoints(EquipCP1, EquipCP2, EquipCP3);

//AddByThreePoins报错

//求指点

3 条回复3
2 条消息(共 4 条)

我对C#语法不太熟悉,你可以参考下如下VB代码

partDoc = ThisApplication.ActiveDocument
compDef = partDoc.ComponentDefinition
TG = ThisApplication.TransientGeometry
'定义工作点坐标
Point1 = TG.CreatePoint(0, 0, 0)
Point2 = TG.CreatePoint(10, 0, -5)
Point3 = TG.CreatePoint(0, 10, 0)
'创建三个工作点
wpoint1 = compDef.WorkPoints.AddFixed(Point1) 
wpoint2 = compDef.WorkPoints.AddFixed(Point2) 
wpoint3 = compDef.WorkPoints.AddFixed(Point3) 
'根据三个工作点创建工作平面
workPlane1 = compDef.WorkPlanes.AddByThreePoints(wpoint1, wpoint2, wpoint3)


If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!
如果我的回帖解决了您的问题,请点击 "接受为解决方案" 按钮. 这可以帮助其他人更快的找到解决方案!


王 承之
Autodesk AGN [Inventor 俱乐部] Leader
Inventor Club | Bilibili


AGN L    EESignature

3 条消息(共 4 条)

感谢老师之前的回复,我这边遇到点新问题,请老师指教

EquipCP1 X:-25.85222728 Y:-8.145459308 Z:-2.849999675

EquipCP2 X:-25.85222264 Y:-8.145457858 Z:-3.149999675

EquipCP3 X:-25.89690385 Y:-8.002267113 Z:-3.149999675

EquipCP4 X:-25.89690849 Y:-8.002268564 Z:-2.849999675

EquipCP7 X:-25.87131938 Y:-8.151416803 Z:-2.85

我通过1-4点的坐标生成了一个工作平面,并在这个工作平面创建了一个长方形,现需要将长方形拉伸为长方体,7点事与1点对应的长方体顶点坐标,如何将长方形向7点方向拉伸为长方体

标记 (1)
4 条消息(共 4 条)

不同主题建议重新发帖,谢谢


If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!
如果我的回帖解决了您的问题,请点击 "接受为解决方案" 按钮. 这可以帮助其他人更快的找到解决方案!


王 承之
Autodesk AGN [Inventor 俱乐部] Leader
Inventor Club | Bilibili


AGN L    EESignature

找不到想要的内容?向社区提问或分享您的知识。

到论坛发帖  

”