求助 nxopen vb.net 做出面与线的交点 出错
提示:System.NullReferenceException: 未将对象引用设置到对象的实例getpt.CreateSurfaceCurveIntersection(fa, cv.Tag, helppt1, helppt2, outpt) 这一行出错
Public Function createpoint() As Integer
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim getpt As UFPoint
Dim fa As NXOpen.Tag
Dim cv As NXOpen.Tag
fa=intface.Tag 'intface是选的面
cv=intcurve(0).Tag 'intcurve(0)是选的线
Dim helppt1 As NXOpen.Tag
Dim helppt2 As NXOpen.Tag
Dim outpt As NXOpen.Tag = Tag.Null
Dim c1 As Double() = {-640, -409.326198682, 23.052587025}
Dim c2 As Double() = {-640.0, -824.876391165, -13.940597438}
theufsession.Curve.CreatePoint(c1, helppt1)
theufsession.Curve.CreatePoint(c2, helppt2)
getpt.CreateSurfaceCurveIntersection(fa, cv.Tag, helppt1, helppt2, outpt)
End Function
用ug 录制的操作记录 好长,也看不懂,ug录制交点用的是Section,好麻烦 Dim c1 As Double() = {-640, -409.326198682, 23.052587025}
Dim c2 As Double() = {-640.0, -824.876391165, -13.940597438}
theufsession.Curve.CreatePoint(c1, helppt1)
theufsession.Curve.CreatePoint(c2, helppt2)
这些点位是不是录制的,你没改啊? 蓝摩羯 发表于 2019-2-1 09:07
Dim c1 As Double() = {-640, -409.326198682, 23.052587025}
Dim c2 As Double() = {-640.0, -8 ...
我这里不是录制的,求交线需要两个参考点,随手做的,我想做面与线的交点。参考点能不能用空值? UFPoint 是个 Class, 网上说要先实例化,我总是实例化不了。。。 VB不会啊,你可以参考一下 UF_MODL_intersect_curve_to_face Public Function createpoint() As Integer
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
dim theufsession as nxopen.uf.ufsession = nxopen.ug.ufsession.getufsession
Dim fa As NXOpen.Tag
Dim cv As NXOpen.Tag
fa=intface.Tag 'intface是选的面
cv=intcurve(0).Tag 'intcurve(0)是选的线
Dim helppt1 As NXOpen.Tag= Tag.Null
Dim helppt2 As NXOpen.Tag= Tag.Null
Dim outpt As NXOpen.Tag = Tag.Null
theufsession.point.CreateSurfaceCurveIntersection(fa, cv.Tag, helppt1, helppt2, outpt)
End Function
原来不用定义,在uf.ufsession 里,花了两天才试出来。 蓝摩羯 发表于 2019-2-1 10:23
VB不会啊,你可以参考一下 UF_MODL_intersect_curve_to_face
谢谢!了,VC 我也不会,上学时早,只学过C,C语言我看到指针就头痛,所以我就改成vb 了 {:tongue:}{:tongue:}niu就是牛啊,没看看东
页:
[1]