Hi,
I'm quite struggling with Open NX C++.
What I have :
- 3D point coordinate,
- 3 vectors ( supposedly corresponding to kind of local axis, centred on the point coordinate)
- a sketch I have to draw (circle/ellipse) on the XY plane on the local coordinate system.
I managed to get the point drawn, and the axis.
The problem comes when I want to use Sketch. I have to select a plane, and to create a plane I need DatumAxis object, which I don't have ...
This is how I create my axis :
Features::DatumAxisBuilder *datumAxisBuilder1;
datumAxisBuilder1 = workPart->Features()->CreateDatumAxisBuilder(nullFeatures_Feature);
datumAxisBuilder1->SetType(Features::DatumAxisBuilder::TypesPointAndDir);
datumAxisBuilder1->ArcLength()->Expression()->SetRightHandSide("0");
datumAxisBuilder1->SetAssociative(false);
datumAxisBuilder1->SetResizedEndDistance(0.0);
Unit *unit1;
unit1 = datumAxisBuilder1->ArcLength()->Expression()->Units();
//Axis1 Centre
Xform *nullXform(NULL);
Point *point2;
point2 = workPart->Points()->CreatePoint(point, nullXform, SmartObject::UpdateOptionWithinModeling);
datumAxisBuilder1->SetPoint(point2);
Vector3d vector1(a1_x,a1_y,a1_z);
Point3d origin1(0.0, 0.0, 0.0);
ptrA1=NULL;
Direction *direction1;
direction1 = workPart->Directions()->CreateDirection(origin1, vector1, SmartObject::UpdateOptionWithinModeling);
datumAxisBuilder1->SetVector(direction1);
datumAxisBuilder1->ArcLength()->Update(GeometricUtilities::OnPathDimensionBuilder::UpdateReasonPath);
NXObject *nXObject2;
nXObject2 = datumAxisBuilder1->Commit();
I'm sure there's an easy way to do it, certainly more straightforward then building the axis, then from the axis the planes etc ...
I tried building coordinate Systems from the axis, but still didn't know how to choose one plane from it.
Here is the code, in case :
Features::DatumCsysBuilder *datumCsysBuilder1CSY;
datumCsysBuilder1CSY = workPart->Features()->CreateDatumCsysBuilder(nullFeatures_Feature);
Unit *unit1CSY(dynamic_cast<Unit *>(workPart->UnitCollection()->FindObject("MilliMeter")));
Unit *unit2CSY(dynamic_cast<Unit *>(workPart->UnitCollection()->FindObject("Degrees")));
Xform *xformCSY;
xformCSY = workPart->Xforms()->CreateXform(point, direction1 , direction2, SmartObject::UpdateOptionWithinModeling, 1.0);
CartesianCoordinateSystem *cartesianCoordinateSystem1CSY;
cartesianCoordinateSystem1CSY = workPart->CoordinateSystems()->CreateCoordinateSystem(xformCSY, SmartObject::UpdateOptionWithinModeling);
datumCsysBuilder1CSY->SetCsys(cartesianCoordinateSystem1CSY);
datumCsysBuilder1CSY->SetDisplayScaleFactor(1.25);
NXObject *nXObjectCSY;
nXObjectCSY = datumCsysBuilder1CSY->Commit();
Thanks a lot for your help !
re: sketch on plane
At this point are you looking to create a datum plane from the vectors you have, or do you want to select a specific plane of a datum csys?
re: get plane of datum csys
Below is some VB code that will get references to the datum csys origin point, X axis, and XY plane. This should be adequate to create a sketch. Using similar logic, you can get the Y axis, Z axis, YZ plane, and XZ plane if desired.
'NXJournaling.com
'June 11, 2014
'
'Report point, X axis direction, and XY plane normal direction of datum csys.
'This journal reports first found datum csys in the feature tree.
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Module Module1
Sub Main()
Dim theSession As Session = Session.GetSession()
If IsNothing(theSession.Parts.Work) Then
'active part required
Return
End If
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
Const mathTolerance As Double = 0.0001
Dim myPlane As DatumPlane 'XY plane of datum csys
Dim myHRef As DatumAxis 'X axis of datum csys
Dim myPoint As Point 'origin point of datum csys
For Each myFeature As Features.Feature In workPart.Features
If TypeOf (myFeature) Is Features.DatumCsys Then
lw.WriteLine(myFeature.GetFeatureName)
Dim DBuilder As Features.DatumCsysBuilder
DBuilder = workPart.Features.CreateDatumCsysBuilder(myFeature)
Dim DCObj() As TaggedObject = DBuilder.GetCommittedObjects
Dim thePlanes As New List(Of DatumPlane)
Dim theAxes As New List(Of DatumAxis)
Dim tempCsys As CartesianCoordinateSystem
Dim tempXdir As Vector3d
Dim tempYdir As Vector3d
Dim tempZdir As Vector3d
'grab the csys
For Each temp As TaggedObject In DCObj
'lw.WriteLine("type: " & temp.GetType.ToString)
If TypeOf (temp) Is CartesianCoordinateSystem Then
tempCsys = temp
tempCsys.GetDirections(tempXdir, tempYdir)
tempZdir.X = tempCsys.Orientation.Element.Zx
tempZdir.Y = tempCsys.Orientation.Element.Zy
tempZdir.Z = tempCsys.Orientation.Element.Zz
'lw.WriteLine("tempCsys found")
'lw.WriteLine("tempXdir: " & tempXdir.ToString)
'lw.WriteLine("tempYdir: " & tempYdir.ToString)
'lw.WriteLine("tempZdir: " & tempZdir.ToString)
'lw.WriteLine("")
End If
If TypeOf (temp) Is Point Then
myPoint = temp
End If
'axes seem to be reported in X, Y, Z order
If TypeOf (temp) Is DatumAxis Then
theAxes.Add(temp)
End If
'planes seem to be reported in XY, YZ, XZ order
If TypeOf (temp) Is DatumPlane Then
thePlanes.Add(temp)
End If
Next
DBuilder.Destroy()
'find the X axis (horizontal sketch reference)
'lw.WriteLine("tempXdir: " & tempXdir.ToString)
For Each tempAxis As DatumAxis In theAxes
'lw.WriteLine("tempAxis direction: " & tempAxis.Direction.ToString)
If Math.Abs(tempAxis.Direction.X - tempXdir.X) < mathTolerance AndAlso _
Math.Abs(tempAxis.Direction.Y - tempXdir.Y) < mathTolerance Then
myHRef = tempAxis
End If
Next
'lw.WriteLine("")
'find the XY plane
'lw.WriteLine("tempZdir: " & tempZdir.ToString)
For Each tempPlane As DatumPlane In thePlanes
'lw.WriteLine("tempPlane normal: " & tempPlane.Normal.ToString)
If Math.Abs(tempPlane.Normal.Z - tempZdir.Z) < mathTolerance AndAlso _
Math.Abs(tempPlane.Normal.X - tempZdir.X) < mathTolerance Then
myPlane = tempPlane
End If
Next
'lw.WriteLine("")
lw.WriteLine("point: " & myPoint.Coordinates.ToString)
lw.WriteLine("X axis direction: " & myHRef.Direction.ToString)
lw.WriteLine("XY plane normal: " & myPlane.Normal.ToString)
Exit For
End If
Next
lw.Close()
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image when the NX session terminates
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
'----Other unload options-------
'Unloads the image immediately after execution within NX
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
'Unloads the image explicitly, via an unload dialog
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
'-------------------------------
End Function
End Module
Actually, I need to do as you
Actually, I need to do as you said to get the planes.
I'm working in C++ and it doesn't work the same way in C++.
I have this :
NXObject *nXObjectCSY;
nXObjectCSY = datumCsysBuilder1CSY->Commit();
//GetCommitedObjects return NXObject and not TaggedObject in c++
std::vector<NXObject*> datumCSYSBuilderObjects = datumCsysBuilder1CSY->GetCommittedObjects();
It finds 8 objects but all are empty. So I guess, this is not the way to do in c++.
Do you have the c++ version of your code ?
Thanks a lot for your help
re: c++ version
Unfortunately, I'm not familiar enough with C++ to translate it and get a working example in C++. Perhaps a forum member here or at the GTAC languages forum (find a link in the resources page) can translate it to working C++ code for you.
With a bit of trying, I found
With a bit of trying, I found out at the end ...
NXObject *nXObjectCSY;
nXObjectCSY = datumCsysBuilder1CSY->Commit();
//Get the DatumCSYS from the DatumCSYSBuilder
datumCsys1 =(dynamic_cast<Features::DatumCsys *>(nXObjectCSY));
// Try getting the Planes from CSYS
std::vector<NXObject*> datumCSYSBuilderObjects = datumCsysBuilder1CSY->GetCommittedObjects();
int count(0);
for (int iter = 0 ; iter != datumCSYSBuilderObjects.size(); ++iter)
{
DatumPlane *newDataPlane(dynamic_cast<DatumPlane*> (datumCSYSBuilderObjects[iter]));
if (newDataPlane != NULL)
{
if(count == 0)
{
//Supposed XY plane
datumPlaneXY = newDataPlane;
}
if(count == 2)
{
//Supposed XZ plane
datumPlaneXZ = newDataPlane;
}
count++;
}
}
C++ version of getting the planes from a CSYS object
NXObject *nXObjectCSY;
nXObjectCSY = datumCsysBuilder1CSY->Commit();
//Get the DatumCSYS from the DatumCSYSBuilder(nXObjectCSY));
datumCsys1 =(dynamic_cast
// Try getting the Planes from CSYS datumCSYSBuilderObjects = datumCsysBuilder1CSY->GetCommittedObjects();
std::vector
int count(0); (datumCSYSBuilderObjects[iter]));
for (int iter = 0 ; iter != datumCSYSBuilderObjects.size(); ++iter)
{
DatumPlane *newDataPlane(dynamic_cast
if (newDataPlane != NULL)
{
if(count == 0)
{
//Supposed XY plane
datumPlaneEllipse = newDataPlane;
}
if(count == 2)
{
//Supposed XZ plane
datumPlaneTrim = newDataPlane;
}
count++;
}
}
thanks
Thanks for posting your solution in C++. I'm sure it will help someone with a similar problem in the future.
Thanks a lot for your help. I
Thanks a lot for your help. I was away and I actually found out a way to do it.
The big problem I had was to get the feature from the builder. I put it here as it could help others
NXObject *nXObjectAxis1;(nXObjectAxis1));
nXObjectAxis1 = datumAxisBuilder1->Commit();
Features::DatumAxisFeature *datumAxis1(dynamic_cast
How to sketch using that CSYS ?
Hey,
Actually, I'm still stuck ... I could draw ellipse easily with that, but now, I'd like to make rectangle, and it gets messy ...
I try to use the SketchPolygonBuilder to be sure to be in the Sketch Plane.
For sure, I'm in the good plane, but I don't understand the data I should put to draw the rectangle. It doesn't seem to take into account the centrePoint I give (at least not in the good CSYS).
If I don't use the SketchPolygonBuilder, and just draw four lines then add constraints, even if I put
myDatumCsys->SetWcsAtCsys();
My new CSYS is still not in use, and I got errors like the lines I want to draw are not in the plane.
So, how do I set a CSYS to use ? Or how do I draw a rectangle in a specific plane ?
Thanks a lot !
re: sketch on csys
Specifying coordinates in NXOpen is done w.r.t. the absolute coordinate system. However, there are a few functions that will convert between global and local coordinates. Moving the WCS to your coordinate system of choice is a good first step, you can then use the 'mapping' functions to convert your coordinates.
Sample code for using the mapping functions can be found at:
http://nxjournaling.com/?q=comment/261#comment-261
Well, I need the C++ version
Well, I need the C++ version obviously :-)
I didn't manage to find it ...
re: map point
In the help file, it is listed as:
UF_CSYS_map_point
defined in: uf_csys.h
I don't know if there are separate versions of the function for C vs C++, but perhaps this will point you in the right direction.
re: map point
It may seems a stupid question but how do you get the ufs ?
Dim ufs As UFSession = UFSession.GetUFSession()
I don't manage to get hold on it in C++.
Map Point
If you want to add some Open C calls into your C++ code, you do not need to call GetUFSession(), but you DO need to call UF_initialize() instead. Be sure to add in the appropriate headers - in this case, at least uf.h and uf_csys.h.
At the end of your program call UF_terminate().
Look for the "interop" examples in ...ugopen\SampleNXOpenApplications\... where NX is installed on your system.
Drawing a line(in sketch)by user to select plane and start point
Below is the code I recorded to generate a sketch and the line with specific length. Please suggest modifying the codes that will allow users to select any plane and the start point (randomly on a surface) and then create the line with predefined length.
' NX 11.0.0.33
' Journal created by z003h08a on Thu May 24 09:30:41 2018 Eastern Daylight 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
Dim scaleAboutPoint1 As NXOpen.Point3d = New NXOpen.Point3d(-18.398383723119469, -4.0352283319112114, 0.0)
Dim viewCenter1 As NXOpen.Point3d = New NXOpen.Point3d(18.398383723119437, 4.0352283319111253, 0.0)
workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint1, viewCenter1)
Dim scaleAboutPoint2 As NXOpen.Point3d = New NXOpen.Point3d(-14.89930461013356, -3.8602743762619056, 0.0)
Dim viewCenter2 As NXOpen.Point3d = New NXOpen.Point3d(14.89930461013353, 3.8602743762618279, 0.0)
workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint2, viewCenter2)
Dim scaleAboutPoint3 As NXOpen.Point3d = New NXOpen.Point3d(-11.919443688106851, -3.0882195010095321, 0.0)
Dim viewCenter3 As NXOpen.Point3d = New NXOpen.Point3d(11.919443688106821, 3.088219501009458, 0.0)
workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint3, viewCenter3)
' ----------------------------------------------
' Menu: Insert->Sketch...
' ----------------------------------------------
Dim markId1 As NXOpen.Session.UndoMarkId = Nothing
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
Dim nullNXOpen_Sketch As NXOpen.Sketch = Nothing
Dim sketchInPlaceBuilder1 As NXOpen.SketchInPlaceBuilder = Nothing
sketchInPlaceBuilder1 = workPart.Sketches.CreateSketchInPlaceBuilder2(nullNXOpen_Sketch)
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)
sketchInPlaceBuilder1.PlaneReference = plane1
Dim unit1 As NXOpen.Unit = CType(workPart.UnitCollection.FindObject("Inch"), 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)
sketchInPlaceBuilder1.OriginOption = NXOpen.OriginMethod.WorkPartOrigin
Dim sketchAlongPathBuilder1 As NXOpen.SketchAlongPathBuilder = Nothing
sketchAlongPathBuilder1 = workPart.Sketches.CreateSketchAlongPathBuilder(nullNXOpen_Sketch)
sketchAlongPathBuilder1.PlaneLocation.Expression.RightHandSide = "0"
theSession.SetUndoMarkName(markId1, "Create Sketch Dialog")
Dim scalar1 As NXOpen.Scalar = Nothing
scalar1 = workPart.Scalars.CreateScalar(1.0, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim extrude1 As NXOpen.Features.Extrude = CType(workPart.Features.FindObject("EXTRUDE(66)"), NXOpen.Features.Extrude)
Dim edge1 As NXOpen.Edge = CType(extrude1.FindObject("EDGE * 170 SB_TAB(1) 2 {(0,22.2,1.6875)(0,23.2,1.6875)(0,24.2,1.6875) SB_TAB(1)}"), NXOpen.Edge)
Dim point1 As NXOpen.Point = Nothing
point1 = workPart.Points.CreatePoint(edge1, scalar1, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim edge2 As NXOpen.Edge = CType(extrude1.FindObject("EDGE * 160 SB_TAB(1) 2 {(0,22.2,1.4375)(0,22.2,1.5625)(0,22.2,1.6875) SB_TAB(1)}"), NXOpen.Edge)
Dim direction1 As NXOpen.Direction = Nothing
direction1 = workPart.Directions.CreateDirection(edge2, NXOpen.Sense.Forward, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim tab1 As NXOpen.Features.Tab = CType(workPart.Features.FindObject("SB_TAB(1)"), NXOpen.Features.Tab)
Dim face1 As NXOpen.Face = CType(tab1.FindObject("FACE 2 {(0,23.5,17.9375) SB_TAB(1)}"), NXOpen.Face)
Dim xform1 As NXOpen.Xform = Nothing
xform1 = workPart.Xforms.CreateXformByPlaneXDirPoint(face1, direction1, point1, NXOpen.SmartObject.UpdateOption.WithinModeling, 0.625, False, False)
Dim cartesianCoordinateSystem1 As NXOpen.CartesianCoordinateSystem = Nothing
cartesianCoordinateSystem1 = workPart.CoordinateSystems.CreateCoordinateSystem(xform1, NXOpen.SmartObject.UpdateOption.WithinModeling)
sketchInPlaceBuilder1.Csystem = cartesianCoordinateSystem1
Dim origin2 As NXOpen.Point3d = New NXOpen.Point3d(0.0, 0.0, 0.0)
Dim normal2 As NXOpen.Vector3d = New NXOpen.Vector3d(0.0, 0.0, 1.0)
Dim plane2 As NXOpen.Plane = Nothing
plane2 = workPart.Planes.CreatePlane(origin2, normal2, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim expression3 As NXOpen.Expression = Nothing
expression3 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim expression4 As NXOpen.Expression = Nothing
expression4 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim origin3 As NXOpen.Point3d = New NXOpen.Point3d(0.0, 0.0, 0.0)
Dim normal3 As NXOpen.Vector3d = New NXOpen.Vector3d(0.0, 0.0, 1.0)
Dim geometry1(0) As NXOpen.NXObject
geometry1(0) = face1
Dim plane3 As NXOpen.Plane = Nothing
plane3 = workPart.Planes.CreatePlane(NXOpen.PlaneTypes.MethodType.Coincident, NXOpen.PlaneTypes.AlternateType.One, origin3, normal3, Nothing, False, False, geometry1)
plane3.Evaluate()
plane3.Evaluate()
Dim scalar2 As NXOpen.Scalar = Nothing
scalar2 = workPart.Scalars.CreateScalar(100.0, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim point2 As NXOpen.Point = Nothing
point2 = workPart.Points.CreatePoint(edge1, scalar2, NXOpen.PointCollection.PointOnCurveLocationOption.PercentParameter, NXOpen.SmartObject.UpdateOption.WithinModeling)
Dim nErrs1 As Integer = Nothing
nErrs1 = theSession.UpdateManager.AddToDeleteList(point1)
plane3.SetMethod(NXOpen.PlaneTypes.MethodType.Coincident)
Dim geom1(0) As NXOpen.NXObject
geom1(0) = face1
plane3.SetGeometry(geom1)
plane3.SetAlternate(NXOpen.PlaneTypes.AlternateType.One)
plane3.Evaluate()
Dim markId2 As NXOpen.Session.UndoMarkId = Nothing
markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Create Sketch")
theSession.DeleteUndoMark(markId2, Nothing)
Dim markId3 As NXOpen.Session.UndoMarkId = Nothing
markId3 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Create Sketch")
theSession.Preferences.Sketch.CreateInferredConstraints = True
theSession.Preferences.Sketch.ContinuousAutoDimensioning = True
theSession.Preferences.Sketch.DimensionLabel = NXOpen.Preferences.SketchPreferences.DimensionLabelType.Expression
theSession.Preferences.Sketch.TextSizeFixed = True
theSession.Preferences.Sketch.FixedTextSize = 0.12
theSession.Preferences.Sketch.ConstraintSymbolSize = 3.0
theSession.Preferences.Sketch.DisplayObjectColor = False
theSession.Preferences.Sketch.DisplayObjectName = True
Dim nXObject1 As NXOpen.NXObject = Nothing
nXObject1 = sketchInPlaceBuilder1.Commit()
Dim sketch1 As NXOpen.Sketch = CType(nXObject1, NXOpen.Sketch)
Dim feature1 As NXOpen.Features.Feature = Nothing
feature1 = sketch1.Feature
Dim markId4 As NXOpen.Session.UndoMarkId = Nothing
markId4 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "update")
Dim nErrs2 As Integer = Nothing
nErrs2 = theSession.UpdateManager.DoUpdate(markId4)
sketch1.Activate(NXOpen.Sketch.ViewReorient.False)
theSession.DeleteUndoMark(markId3, Nothing)
theSession.SetUndoMarkName(markId1, "Create Sketch")
sketchInPlaceBuilder1.Destroy()
sketchAlongPathBuilder1.Destroy()
Try
' Expression is still in use.
workPart.Expressions.Delete(expression2)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
workPart.Points.DeletePoint(point2)
Try
' Expression is still in use.
workPart.Expressions.Delete(expression1)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
plane1.DestroyPlane()
Try
' Expression is still in use.
workPart.Expressions.Delete(expression4)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
Try
' Expression is still in use.
workPart.Expressions.Delete(expression3)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try
plane3.DestroyPlane()
' ----------------------------------------------
' Menu: Insert->Sketch Curve->Line...
' ----------------------------------------------
Dim markId5 As NXOpen.Session.UndoMarkId = Nothing
markId5 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Profile short list")
Dim markId6 As NXOpen.Session.UndoMarkId = Nothing
markId6 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Curve")
Dim expression5 As NXOpen.Expression = Nothing
expression5 = workPart.Expressions.CreateSystemExpression("4.08722170647")
Dim scaleAboutPoint4 As NXOpen.Point3d = New NXOpen.Point3d(-10.14236299278911, 4.2621041066563459, 0.0)
Dim viewCenter4 As NXOpen.Point3d = New NXOpen.Point3d(10.142362992789071, -4.2621041066564187, 0.0)
workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint4, viewCenter4)
Dim scaleAboutPoint5 As NXOpen.Point3d = New NXOpen.Point3d(-8.1138903942312925, 3.4096832853250709, 0.0)
Dim viewCenter5 As NXOpen.Point3d = New NXOpen.Point3d(8.1138903942312552, -3.4096832853251473, 0.0)
workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint5, viewCenter5)
Dim scaleAboutPoint6 As NXOpen.Point3d = New NXOpen.Point3d(-6.4911123153850383, 2.7277466282600478, 0.0)
Dim viewCenter6 As NXOpen.Point3d = New NXOpen.Point3d(6.4911123153849992, -2.727746628260125, 0.0)
workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint6, viewCenter6)
Dim scaleAboutPoint7 As NXOpen.Point3d = New NXOpen.Point3d(-5.192889852308034, 2.1821973026080284, 0.0)
Dim viewCenter7 As NXOpen.Point3d = New NXOpen.Point3d(5.1928898523079949, -2.1821973026081078, 0.0)
workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint7, viewCenter7)
Dim scaleAboutPoint8 As NXOpen.Point3d = New NXOpen.Point3d(-4.1543118818464304, 1.7457578420864159, 0.0)
Dim viewCenter8 As NXOpen.Point3d = New NXOpen.Point3d(4.1543118818463931, -1.7457578420864943, 0.0)
workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint8, viewCenter8)
theSession.SetUndoMarkVisibility(markId6, "Curve", NXOpen.Session.MarkVisibility.Visible)
Dim startPoint1 As NXOpen.Point3d = New NXOpen.Point3d(0.0, 20.664134191313259, 5.7936096440659046)
Dim endPoint1 As NXOpen.Point3d = New NXOpen.Point3d(0.0, 20.664134191313259, 9.8808313505359049)
Dim line1 As NXOpen.Line = Nothing
line1 = workPart.Curves.CreateLine(startPoint1, endPoint1)
theSession.ActiveSketch.AddGeometry(line1, NXOpen.Sketch.InferConstraintsOption.InferNoConstraints)
Dim geom2 As NXOpen.Sketch.ConstraintGeometry = Nothing
geom2.Geometry = line1
geom2.PointType = NXOpen.Sketch.ConstraintPointType.None
geom2.SplineDefiningPointIndex = 0
Dim sketchGeometricConstraint1 As NXOpen.SketchGeometricConstraint = Nothing
sketchGeometricConstraint1 = theSession.ActiveSketch.CreateHorizontalConstraint(geom2)
Dim dimObject1_1 As NXOpen.Sketch.DimensionGeometry = Nothing
dimObject1_1.Geometry = line1
dimObject1_1.AssocType = NXOpen.Sketch.AssocType.StartPoint
dimObject1_1.AssocValue = 0
dimObject1_1.HelpPoint.X = 0.0
dimObject1_1.HelpPoint.Y = 0.0
dimObject1_1.HelpPoint.Z = 0.0
Dim nullNXOpen_NXObject As NXOpen.NXObject = Nothing
dimObject1_1.View = nullNXOpen_NXObject
Dim dimObject2_1 As NXOpen.Sketch.DimensionGeometry = Nothing
dimObject2_1.Geometry = line1
dimObject2_1.AssocType = NXOpen.Sketch.AssocType.EndPoint
dimObject2_1.AssocValue = 0
dimObject2_1.HelpPoint.X = 0.0
dimObject2_1.HelpPoint.Y = 0.0
dimObject2_1.HelpPoint.Z = 0.0
dimObject2_1.View = nullNXOpen_NXObject
Dim dimOrigin1 As NXOpen.Point3d = New NXOpen.Point3d(0.0, 20.336902240004743, 7.8372204973009048)
Dim sketchDimensionalConstraint1 As NXOpen.SketchDimensionalConstraint = Nothing
sketchDimensionalConstraint1 = theSession.ActiveSketch.CreateDimension(NXOpen.Sketch.ConstraintType.ParallelDim, dimObject1_1, dimObject2_1, dimOrigin1, expression5, NXOpen.Sketch.DimensionOption.CreateAsDriving)
Dim sketchHelpedDimensionalConstraint1 As NXOpen.SketchHelpedDimensionalConstraint = CType(sketchDimensionalConstraint1, NXOpen.SketchHelpedDimensionalConstraint)
Dim dimension1 As NXOpen.Annotations.Dimension = Nothing
dimension1 = sketchHelpedDimensionalConstraint1.AssociatedDimension
theSession.Preferences.Sketch.AutoDimensionsToArcCenter = False
theSession.ActiveSketch.Update()
theSession.Preferences.Sketch.AutoDimensionsToArcCenter = True
' ----------------------------------------------
' Dialog Begin Line
' ----------------------------------------------
Dim scaleAboutPoint9 As NXOpen.Point3d = New NXOpen.Point3d(-3.6832531556427632, 1.036802623503509, 0.0)
Dim viewCenter9 As NXOpen.Point3d = New NXOpen.Point3d(3.683253155642725, -1.0368026235035877, 0.0)
workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint9, viewCenter9)
Dim scaleAboutPoint10 As NXOpen.Point3d = New NXOpen.Point3d(-4.6040664445534505, 1.2960032793793965, 0.0)
Dim viewCenter10 As NXOpen.Point3d = New NXOpen.Point3d(4.6040664445534105, -1.2960032793794751, 0.0)
workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint10, viewCenter10)
Dim scaleAboutPoint11 As NXOpen.Point3d = New NXOpen.Point3d(-5.7550830556918084, 1.6200040992242553, 0.0)
Dim viewCenter11 As NXOpen.Point3d = New NXOpen.Point3d(5.7550830556917658, -1.6200040992243327, 0.0)
workPart.ModelingViews.WorkView.ZoomAboutPoint(0.80000000000000004, scaleAboutPoint11, viewCenter11)
' ----------------------------------------------
' Menu: File->Finish Sketch
' ----------------------------------------------
Dim markId7 As NXOpen.Session.UndoMarkId = Nothing
markId7 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Deactivate Sketch")
theSession.ActiveSketch.Deactivate(NXOpen.Sketch.ViewReorient.False, NXOpen.Sketch.UpdateLevel.Model)
' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
End Sub
End Module
Regards,
MFJ