本文主要是介绍EdgeUse 和 Edge的Evaluator 区别,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
我的同事Adam最近写了篇关于EdgeUse 和 Edge的Evaluator 的区别。EdgeUse 和 Edge是初学Inventor Brep容易混淆和迷惑的知识。我认为Adam的这篇文章有一定帮助。特翻译如下。原文地址:
http://adndevblog.typepad.com/manufacturing/2013/03/evaluator-of-edgeuse-vs-edge.html
EdgeUse 提供了基于边Edge所在面Face上下文的信息。所以其Evaluator是Curve2dEvaluator ,返回的是基于面Face的信息,即返回的坐标信息是在面的参数空间内Face (u, v). 如果需要在模型空间上下文的坐标信息,则需要用Face的Evaluator 把u,v转换成模型坐标(x, y, z) 。
而Edge是基于模型空间,其Evaluator 也是Curve2dEvaluator,但返回的是模型空间坐标。
下图是个图例说明。实际中,可能0点的u,v不在面或边的起点。你需要用相应的方法先获取最小和最大值做判断。
以下代码演示了EdgeUse的Evaluator的 坐标,面Face的 u,v坐标,以及模型空间坐标。先选取一个面,执行代码:
Sub PlaceParametricPoints()Dim oDoc As PartDocumentSet oDoc = ThisApplication.ActiveDocumentDim oFace As FaceSet oFace = oDoc.SelectSet(1)Dim oCompDef As PartComponentDefinitionSet oCompDef = oDoc.ComponentDefinitionDim oWPs As WorkPointsSet oWPs = oCompDef.WorkPointsDim oEdgeLoop As EdgeLoopFor Each oEdgeLoop In oFace.EdgeLoopsDim oEdgeUse As EdgeUseFor Each oEdgeUse In oEdgeLoop.EdgeUsesDim oEval As Curve2dEvaluatorSet oEval = oEdgeUse.Evaluator' 获取曲线参数范围 Dim oMinU As DoubleDim oMaxU As DoubleCall oEval.GetParamExtents(oMinU, oMaxU)' 获取面上参数化点Dim oParams(1) As DoubleDim oFaceUV() As DoubleoParams(0) = oMinUoParams(1) = oMaxUCall oEval.GetPointAtParam(oParams, oFaceUV)' 计算出对应模型空间点 Dim oModel() As DoubleCall oFace.Evaluator.GetPointAtParam(oFaceUV, oModel)Dim oTG As TransientGeometrySet oTG = ThisApplication.TransientGeometry‘利用模型空间点增加一个工作点Call oWPs.AddFixed(oTG.CreatePoint( _oModel(0), oModel(1), oModel(2)))Debug.Print _"> Min Point >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + vbCrLf + _" Edge u = " + str(oMinU) + vbCrLf + _" Face u = " + str(oFaceUV(0)) + _", v = " + str(oFaceUV(1)) + vbCrLf + _" Model x = " + str(oModel(0)) + _", y = " + str(oModel(1)) + _", z = " + str(oModel(2)) + vbCrLf + _"> Max Point >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + vbCrLf + _" Edge u = " + str(oMaxU) + vbCrLf + _" Face u = " + str(oFaceUV(2)) + _", v = " + str(oFaceUV(3)) + vbCrLf + _" Model x = " + str(oModel(3)) + _", y = " + str(oModel(4)) + _", z = " + str(oModel(5))NextNext
End Sub
这篇关于EdgeUse 和 Edge的Evaluator 区别的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!