Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Nx Journaling - Orient WCS as per User selected Cylindrical Edge.

Status
Not open for further replies.

Kumaresh_07

Automotive
Jul 21, 2019
14
0
0
IN
Hi all,

I would like to create one journal to Orient my WCS as per selected cylindrical edge.
I have spent so much of time with this. But still I couldn't figure out.
My requirement is while running the journal, it will ask me to select a Cylindrical Edge, Once I select the cylindrical Edge, WCS will oriented as per that edge (Note : Selection scope should be Entire Assembly).

If you have any further clarification means, please check attached Nx Recorded video.

It would be great, if someone help with this.



 
 https://files.engineering.com/getfile.aspx?folder=78e619e6-c252-4a8d-9748-adcc1e11a939&file=Orient_Wcs.avi
Replies continue below

Recommended for you

Did You try to record journal, it's much easier (sometimes) to edit recorded file, than create it from scratch? Sometimes nothing is recorded, so the nxopen doesn't support some features for example boss.

With best regards
Michael
 
What do you mean
“Orient my WCS as per selected cylindrical edge” ??

Where do you want the origin, the x-axis, and the y-axis to go?
 
Hi Michael,

yes , i have also tried to create my required journal from recorded journal.
But I don't know how to code for user going to select cylindrical edge.
please check below recorded journal & attached video link for better understanding.

Code:
' NX 11.0.0.33
' Journal created by MuthuKumar on Thu May 14 10:15:37 2020 Pacific Standard Time
'
Imports System
Imports NXOpen

Module NXJournal
Sub Main (ByVal args() As String) 

Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work

Dim displayPart As NXOpen.Part = theSession.Parts.Display

' ----------------------------------------------
'   Menu: Format->WCS->Orient...
' ----------------------------------------------
Dim markId1 As NXOpen.Session.UndoMarkId = Nothing
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")

Dim origin1 As NXOpen.Point3d = New NXOpen.Point3d(0.0, 0.0, 0.0)
Dim normal1 As NXOpen.Vector3d = New NXOpen.Vector3d(0.0, 0.0, 1.0)
Dim plane1 As NXOpen.Plane = Nothing
plane1 = workPart.Planes.CreatePlane(origin1, normal1, NXOpen.SmartObject.UpdateOption.WithinModeling)

Dim unit1 As NXOpen.Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), NXOpen.Unit)

Dim expression1 As NXOpen.Expression = Nothing
expression1 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)

Dim expression2 As NXOpen.Expression = Nothing
expression2 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)

Dim expression3 As NXOpen.Expression = Nothing
expression3 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)

Dim unit2 As NXOpen.Unit = CType(workPart.UnitCollection.FindObject("Degrees"), NXOpen.Unit)

Dim expression4 As NXOpen.Expression = Nothing
expression4 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit2)

Dim expression5 As NXOpen.Expression = Nothing
expression5 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)

Dim expression6 As NXOpen.Expression = Nothing
expression6 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit2)

Dim expression7 As NXOpen.Expression = Nothing
expression7 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)

Dim expression8 As NXOpen.Expression = Nothing
expression8 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit2)

expression3.RightHandSide = "0"

expression5.RightHandSide = "0"

expression7.RightHandSide = "0"

expression4.RightHandSide = "0"

expression6.RightHandSide = "0"

expression8.RightHandSide = "0"

expression3.RightHandSide = "0"

expression5.RightHandSide = "0"

expression7.RightHandSide = "0"

expression4.RightHandSide = "0"

expression6.RightHandSide = "0"

expression8.RightHandSide = "0"

expression3.RightHandSide = "0"

expression5.RightHandSide = "0"

expression7.RightHandSide = "0"

expression4.RightHandSide = "0"

expression6.RightHandSide = "0"

expression8.RightHandSide = "0"

theSession.SetUndoMarkName(markId1, "CSYS Dialog")

Dim xform1 As NXOpen.Xform = Nothing
xform1 = workPart.Xforms.CreateXformFromCurrentView(NXOpen.SmartObject.UpdateOption.AfterModeling, 1.0)

Dim scaleAboutPoint1 As NXOpen.Point3d = New NXOpen.Point3d(-26.512835686764909, 25.133555217514996, 0.0)
Dim viewCenter1 As NXOpen.Point3d = New NXOpen.Point3d(26.512835686769108, -25.133555217511528, 0.0)
workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint1, viewCenter1)

Dim scaleAboutPoint2 As NXOpen.Point3d = New NXOpen.Point3d(-14.099311463480962, 14.221914171862887, 0.0)
Dim viewCenter2 As NXOpen.Point3d = New NXOpen.Point3d(14.09931146348517, -14.221914171859439, 0.0)
workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint2, viewCenter2)

Dim scaleAboutPoint3 As NXOpen.Point3d = New NXOpen.Point3d(-10.690956170569409, 10.200545337060735, 0.0)
Dim viewCenter3 As NXOpen.Point3d = New NXOpen.Point3d(10.690956170573624, -10.200545337057326, 0.0)
workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint3, viewCenter3)

Dim scaleAboutPoint4 As NXOpen.Point3d = New NXOpen.Point3d(-7.4542446693871902, 8.0035048029249509, 0.0)
Dim viewCenter4 As NXOpen.Point3d = New NXOpen.Point3d(7.4542446693913993, -8.0035048029215456, 0.0)
workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint4, viewCenter4)

Dim brep1 As NXOpen.Features.Brep = CType(workPart.Features.FindObject("UNPARAMETERIZED_FEATURE(0)"), NXOpen.Features.Brep)

Dim edge1 As NXOpen.Edge = CType(brep1.FindObject("EDGE * 6 * 9 {(10,34.0078098595757,30.9496300155993)(10,29.2446701387613,39.1996300155993)(10,24.4815304179469,30.9496300155993) UNPARAMETERIZED_FEATURE(0)}"), NXOpen.Edge)

Dim xform2 As NXOpen.Xform = Nothing
xform2 = workPart.Xforms.CreateXform(edge1, NXOpen.SmartObject.UpdateOption.AfterModeling)

Dim markId2 As NXOpen.Session.UndoMarkId = Nothing
markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "CSYS")

theSession.DeleteUndoMark(markId2, Nothing)

Dim markId3 As NXOpen.Session.UndoMarkId = Nothing
markId3 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "CSYS")

Dim cartesianCoordinateSystem1 As NXOpen.CartesianCoordinateSystem = Nothing
cartesianCoordinateSystem1 = workPart.CoordinateSystems.CreateCoordinateSystem(xform2, NXOpen.SmartObject.UpdateOption.AfterModeling)

xform2.RemoveParameters()

theSession.DeleteUndoMark(markId3, Nothing)

theSession.SetUndoMarkName(markId1, "CSYS")

workPart.Expressions.Delete(expression3)

workPart.Expressions.Delete(expression5)

workPart.Expressions.Delete(expression7)

workPart.Expressions.Delete(expression4)

workPart.Expressions.Delete(expression6)

workPart.Expressions.Delete(expression8)

Try
  ' Expression is still in use.
  workPart.Expressions.Delete(expression2)
Catch ex As NXException
  ex.AssertErrorCode(1050029)
End Try

Try
  ' Expression is still in use.
  workPart.Expressions.Delete(expression1)
Catch ex As NXException
  ex.AssertErrorCode(1050029)
End Try

plane1.DestroyPlane()

Dim nErrs1 As Integer = Nothing
nErrs1 = theSession.UpdateManager.AddToDeleteList(cartesianCoordinateSystem1)

Dim objects1(0) As NXOpen.NXObject
Dim cartesianCoordinateSystem2 As NXOpen.CartesianCoordinateSystem = CType(workPart.FindObject("ENTITY 45 1"), NXOpen.CartesianCoordinateSystem)

objects1(0) = cartesianCoordinateSystem2
Dim nErrs2 As Integer = Nothing
nErrs2 = theSession.UpdateManager.AddToDeleteList(objects1)

Dim origin2 As NXOpen.Point3d = New NXOpen.Point3d(10.0, 29.2446701387613, 33.699630015599304)
Dim matrix1 As NXOpen.Matrix3x3 = Nothing
matrix1.Xx = 6.4594794160009188e-016
matrix1.Xy = 0.0
matrix1.Xz = 1.0
matrix1.Yx = 0.0
matrix1.Yy = 1.0
matrix1.Yz = -0.0
matrix1.Zx = -1.0
matrix1.Zy = 0.0
matrix1.Zz = 6.4594794160009188e-016
workPart.WCS.SetOriginAndMatrix(origin2, matrix1)

Dim id1 As NXOpen.Session.UndoMarkId = Nothing
id1 = theSession.NewestVisibleUndoMark

Dim nErrs3 As Integer = Nothing
nErrs3 = theSession.UpdateManager.DoUpdate(id1)

' ----------------------------------------------
'   Menu: Tools->Journal->Stop Recording
' ----------------------------------------------

End Sub
End Module


I want to modify above journal as like below steps.
while run the journal,
1)User prompt to select a cylindrical edge.
2)once cylindrical edge selected,,, then wcs going to automatically oriented as per selected cylindrical edge.(Using Orient WCS option).

please check attached video.
 
 https://files.engineering.com/getfile.aspx?folder=d9f3d8ee-8c41-4bcf-967d-5ae7e068b84c&file=Orient_Wcs.avi
I created something, but it still need some improvement - orient vectors.

Code:
Option Strict Off

Imports System
Imports NXOpen
Imports NXOpen.UF

Module NXJournal

	Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
	Dim ufs As UFSession = UFSession.GetUFSession()
	Dim sel As Selection = NXOpen.UI.GetUI.SelectionManager
	Dim workPart As NXOpen.Part = theSession.Parts.Work
	Dim displayPart As NXOpen.Part = theSession.Parts.Display
	Public lw As ListingWindow = theSession.ListingWindow
		
Sub Main (ByVal args() As String) 

	Dim myArc As NXObject
	
	lw.open()
	
	Dim markId1 As NXOpen.Session.UndoMarkId = Nothing
	markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")

	theSession.SetUndoMarkName(markId1, "CSYS Dialog")


	Dim edge1 As NXOpen.Edge 
	
	if SelectCylEdge(myarc) = Selection.Response.Cancel Then 
	
		exit sub
		
	end if 	
	
	edge1 = myarc
	
	'if ufs.Modl.AskCurveclosed(edge1.tag) = 1 then 
		
	'else 
		
	'	return
	
	'end if
	
	Dim edgeEvaluator As System.IntPtr
	ufs.Eval.Initialize(myArc.Tag, edgeEvaluator)
		
	Dim edgeArcTag As Tag
	ufs.Modl.CreateCurveFromEdge(myArc.Tag, edgeArcTag)
	
	Dim edgeCurve As Arc = Utilities.NXObjectManager.Get(edgeArcTag)

	'lw.WriteLine("Center point: " & edgeCurve.CenterPoint.ToString)

	Dim origin2 As NXOpen.Point3d = New NXOpen.Point3d()
	origin2 = edgeCurve.CenterPoint
	
	Dim markId2 As Session.UndoMarkId
	markId1 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Delete Arc")
	
	Dim nErrs1 As Integer
	nErrs1 = theSession.UpdateManager.AddToDeleteList(edgeCurve)

	Dim nErrs2 As Integer
	nErrs2 = theSession.UpdateManager.DoUpdate(markId2)
			
	Dim xform2 As NXOpen.Xform = Nothing
	xform2 = workPart.Xforms.CreateXform(edge1, NXOpen.SmartObject.UpdateOption.AfterModeling)

	Dim markId3 As NXOpen.Session.UndoMarkId = Nothing
	markId3 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "CSYS")

	theSession.DeleteUndoMark(markId3, Nothing)

	Dim markId4 As NXOpen.Session.UndoMarkId = Nothing
	markId4 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "CSYS")

	'Dim cartesianCoordinateSystem1 As NXOpen.CartesianCoordinateSystem = Nothing
	'cartesianCoordinateSystem1 = workPart.CoordinateSystems.CreateCoordinateSystem(xform2, NXOpen.SmartObject.UpdateOption.AfterModeling)

	xform2.RemoveParameters()

	theSession.DeleteUndoMark(markId3, Nothing)

	theSession.SetUndoMarkName(markId1, "CSYS")


	'plane1.DestroyPlane()
	'Dim nErrs3 As Integer = Nothing
	'nErrs3 = theSession.UpdateManager.AddToDeleteList(cartesianCoordinateSystem1)

	Dim objects1(0) As NXOpen.NXObject
	Dim cartesianCoordinateSystem2 As NXOpen.CartesianCoordinateSystem '= CType(workPart.FindObject("ENTITY 45 1"), NXOpen.CartesianCoordinateSystem)

	objects1(0) = cartesianCoordinateSystem2
	Dim nErrs4 As Integer = Nothing
	nErrs4 = theSession.UpdateManager.AddToDeleteList(objects1)

	
	Dim matrix1 As NXOpen.Matrix3x3 = Nothing
	matrix1.Xx = -1.0
	matrix1.Xy = 0.0
	matrix1.Xz = 0.0
	matrix1.Yx = 0.0
	matrix1.Yy = 1.0
	matrix1.Yz = 0.0
	matrix1.Zx = 0.0
	matrix1.Zy = 0.0
	matrix1.Zz = -1.0
	workPart.WCS.SetOriginAndMatrix(origin2, matrix1)

	Dim id1 As NXOpen.Session.UndoMarkId = Nothing
	id1 = theSession.NewestVisibleUndoMark

	Dim nErrs5 As Integer = Nothing
	nErrs5 = theSession.UpdateManager.DoUpdate(id1)
	
	lw.Close()
	
End Sub

Function SelectCylEdge(ByRef selObj As NXObject) 

	Dim ui As UI = NXOpen.UI.GetUI

	Dim message As String = "Choose cylindrical edge"
	Dim title As String = "Choose cylindrical edge"

	Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart 'AnyInAssembly
	Dim keepHighlighted As Boolean = False
	Dim includeFeatures As Boolean = False
	Dim cursor As Point3d
	Dim response As Selection.Response

	Dim selectionAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific

	Dim selectionMask_array(1) As Selection.MaskTriple
	
	With selectionMask_array(0)
	
		.Type = UFConstants.UF_solid_type
		.Subtype = 0
		.SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_CIRCULAR_EDGE
	
	End With
	
	With selectionMask_array(1)
	
		.Type = UFConstants.UF_circle_type
		.Subtype = 0
		.SolidBodySubtype = 0
	
	End With	   

	response = ui.SelectionManager.SelectObject(message, title, scope, _
	selectionAction, includeFeatures, keepHighlighted, selectionMask_array, selObj, cursor)

	If response = Selection.Response.Cancel Or response = Selection.Response.Back Then
	
		Return Selection.Response.Cancel
		
	else
	
		Return Selection.Response.ok
	
	End If

	
End Function

Public Function GetUnloadOption(ByVal dummy As String) As Integer

	GetUnloadOption = NXOpen.UF.UFConstants.UF_UNLOAD_IMMEDIATELY

End Function
	
End Module

With best regards
Michael
 
Hi Michael,

First of all ,I m a beginner in Nx journaling,From you people i learned lot of stuffs.
You almost done.Thank you very much for your efforts.

Yes , In Your modified journal the one and only issue is wcs orientation.
I m trying to figure out almost 6 hours for this.Still i couldn't. But i have some hints ,it may be helpful to you.

Code:
workPart.WCS.SetOriginAndMatrix(origin2, matrix1)

The above code snippet shows main functional part of our journal. The main two stuffs are origin2 & matrix1.
You already fixed the first stuff origin2 as per selected cylindrical edge.
But the second one is : matrix1.
As of my knowledge, For fixing orientation we need 3x3 Matrix. So we can declared above matrix1 as matrix 3x3.
But here my issue is , I don't know how to extract matrix 3X3 values from selected circular edge.
So for, temporary solution : By using below code snippet, I have extracted matrix values from current wcs orientation.

Code:
Dim matrix1 As NXOpen.Matrix3x3 = workPart.WCS.CoordinateSystem.Orientation.Element

But this temporary solution is not good so far.
Please let me know , if u have any idea about extract matrix 3X3 values from selected circular edge.

Thanks for everything Boss!
 
In niedzviedz's code, an arc (edgeCurve) is created from the selected edge. You can get all you need (origin and orientation) from this object.

[spoiler big hint]take a look at the .Matrix property. The .GetOrientation method would also be useful here, but might take more work to get what you want.[/spoiler]
www.nxjournaling.com
 
I dig in documentation and Arc.GetOrientation provide origin and 2 vectors3D x and y. What about third one z? Matrix3x3 need 9 values: Xx, Xy, Xz, Yx, Yy, Yz, Zx, Zy and Zz. How to convert Vectors3D to Matrix?
I tried this, but it doesn't work properly (Csys vectors are in different directions):

Code:
Dim Vec1 As NXOpen.Vector3d = New NXOpen.Vector3d
Dim Vec2 as NXOpen.Vector3d	= New NXOpen.Vector3d
edgeCurve.GetOrientation(origin3, Vec1, Vec1)
Dim x As Double
Dim y As Double
Dim z As Double
x = Vec1.x - Vec2.x
y = Vec1.y - Vec2.y
z = Vec1.z - Vec2.z
Dim Vec3 as NXOpen.Vector3d	= New NXOpen.Vector3d(x, y, z) 

Dim matrix1 As NXOpen.Matrix3x3 = Nothing
matrix1.Xx = Vec3.x
matrix1.Xy = Vec3.y
matrix1.Xz = Vec3.z
matrix1.Yx = Vec1.x
matrix1.Yy = Vec1.y
matrix1.Yz = Vec1.z
matrix1.Zx = Vec2.x
matrix1.Zy = Vec2.y
matrix1.Zz = Vec2.z


With best regards
Michael
 
The .Matrix property of the arc object is the easy way out. But if you really want to use the .GetOrientation method, you can use the vector cross product <Xvec> x <Yvec> to get the Z vector and use those values in your matrix. There are functions in the API for the vector cross product (or you can create your own, it isn't difficult math). However, I'd suggest using the UF_MTX3_initialize method. This method will take the X and Y vectors (3 element arrays of values representing the vectors) and return an array representing the orientation matrix. These values can then be fed into your orientation matrix object.

www.nxjournaling.com
 
.Matrix property of the arc gives Matrix 2x2, so I have to convert it to Matrix3x3 to use it in "workPart.WCS.SetOriginAndMatrix(origin2, matrix1)". I have changed csaslculation for Z vector, but result is alvays the same.

Code:
x = Vec1.y * Vec2.z - Vec1.z * Vec2.y
y = Vec1.x * Vec2.z - Vec1.z * Vec2.x
z = Vec1.x * Vec2.y - Vec1.y * Vec2.x

lw.writeline(Vec1.tostring)
lw.writeline(Vec2.tostring)
lw.writeline(Vec3.tostring)
Here are values for 3 vectors, and there aren't much changes if hole is horizontal or vertical = first vector has some values, but second and third are zeros.

[X=0,Y=1,Z=0]
[X=0,Y=0,Z=0]
[X=0,Y=0,Z=0]

With best regards
Michael
 
Thanks @Cowski,

this method solve it. With vector I received unpredictable solutions. Below is updated code:

Code:
Option Strict Off

Imports System
Imports NXOpen
Imports NXOpen.UF

Module NXJournal

	Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
	Dim ufs As UFSession = UFSession.GetUFSession()
	Dim sel As Selection = NXOpen.UI.GetUI.SelectionManager
	Dim workPart As NXOpen.Part = theSession.Parts.Work
	Dim displayPart As NXOpen.Part = theSession.Parts.Display
	Public lw As ListingWindow = theSession.ListingWindow
		
Sub Main (ByVal args() As String) 

	Dim myArc As NXObject
	
	lw.open()
	
	Dim markId1 As NXOpen.Session.UndoMarkId = Nothing
	markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")

	theSession.SetUndoMarkName(markId1, "CSYS Dialog")

	Dim edge1 As NXOpen.Edge 
	
	if SelectCylEdge(myarc) = Selection.Response.Cancel Then 
	
		exit sub
		
	end if 	
	
	edge1 = myarc
	
	Dim edgeEvaluator As System.IntPtr
	ufs.Eval.Initialize(myArc.Tag, edgeEvaluator)
		
	Dim edgeArcTag As Tag
	ufs.Modl.CreateCurveFromEdge(myArc.Tag, edgeArcTag)
	
	Dim edgeCurve As Arc = Utilities.NXObjectManager.Get(edgeArcTag)
	
	Dim origin1 As NXOpen.Point3d = New NXOpen.Point3d()	
	
	Dim matrix1 As NXOpen.Matrix3x3 = Nothing
	matrix1 = edgecurve.Matrix.Element 
	
	lw.writeline(Matrix1.tostring)
	
	origin1 = edgeCurve.CenterPoint
	
	Dim markId2 As Session.UndoMarkId
	markId1 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Delete Arc")
	
	Dim nErrs1 As Integer
	nErrs1 = theSession.UpdateManager.AddToDeleteList(edgeCurve)

	Dim nErrs2 As Integer
	nErrs2 = theSession.UpdateManager.DoUpdate(markId2)
			
	Dim xform2 As NXOpen.Xform = Nothing
	xform2 = workPart.Xforms.CreateXform(edge1, NXOpen.SmartObject.UpdateOption.AfterModeling)

	Dim markId3 As NXOpen.Session.UndoMarkId = Nothing
	markId3 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "CSYS")

	theSession.DeleteUndoMark(markId3, Nothing)

	xform2.RemoveParameters()

	theSession.DeleteUndoMark(markId3, Nothing)
	theSession.SetUndoMarkName(markId1, "CSYS")

	Dim objects1(0) As NXOpen.NXObject
	Dim cartesianCoordinateSystem2 As NXOpen.CartesianCoordinateSystem

	objects1(0) = cartesianCoordinateSystem2
	Dim nErrs4 As Integer = Nothing
	nErrs4 = theSession.UpdateManager.AddToDeleteList(objects1)

	workPart.WCS.SetOriginAndMatrix(origin1, matrix1)

	Dim id1 As NXOpen.Session.UndoMarkId = Nothing
	id1 = theSession.NewestVisibleUndoMark

	Dim nErrs5 As Integer = Nothing
	nErrs5 = theSession.UpdateManager.DoUpdate(id1)
	
	lw.Close()
	
End Sub

Function SelectCylEdge(ByRef selObj As NXObject) 

	Dim ui As UI = NXOpen.UI.GetUI

	Dim message As String = "Choose cylindrical edge"
	Dim title As String = "Choose cylindrical edge"

	Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart 'AnyInAssembly
	Dim keepHighlighted As Boolean = False
	Dim includeFeatures As Boolean = False
	Dim cursor As Point3d
	Dim response As Selection.Response

	Dim selectionAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific

	Dim selectionMask_array(1) As Selection.MaskTriple
	
	With selectionMask_array(0)
	
		.Type = UFConstants.UF_solid_type
		.Subtype = 0
		.SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_CIRCULAR_EDGE
	
	End With
	
	With selectionMask_array(1)
	
		.Type = UFConstants.UF_circle_type
		.Subtype = 0
		.SolidBodySubtype = 0
	
	End With	   

	response = ui.SelectionManager.SelectObject(message, title, scope, _
	selectionAction, includeFeatures, keepHighlighted, selectionMask_array, selObj, cursor)

	If response = Selection.Response.Cancel Or response = Selection.Response.Back Then

		Return Selection.Response.Cancel	

	else

		Return Selection.Response.ok	

	End If

End Function

Public Function GetUnloadOption(ByVal dummy As String) As Integer

	GetUnloadOption = NXOpen.UF.UFConstants.UF_UNLOAD_IMMEDIATELY

End Function
	
End Module

With best regards
Michael
 
Status
Not open for further replies.
Back
Top