Quantcast
Channel: NX Journaling - Journaling / NXOpen API
Viewing all articles
Browse latest Browse all 783

Journal for Engraving

$
0
0

Hello All,
Below journal creates the Engraving on the part body by extracting details from part attributes such as Description, Part number (removed the last 5 characters of the string from the part number for my requirement)& Weight.

' NX 12.0.1.7' Journal created by Balaji_Sampath03 on Tue Jul 21 20:07:10 2020 India Standard Time'**************************************************************************************'This Journal creates the Engraving on the NX part with attribute info such as'1> Description'2> Part Number (last 4 characters of the string from part number is removed) and '3> Weight'This Journal does not have any exception to catch any errors'Has option to invert the direction of the Offset curve before the final extrude option'***************************************************************************************Option Strict Off
Imports System
Imports System.Collections.GenericImports NXOpen
Imports NXOpen.UIImports NXOpen.UF 
Module NXJournal
 
	Dim theUfSession As UFSession = UFSession.GetUFSession()Dim theSession As NXOpen.Session= NXOpen.Session.GetSession()Dim workPart As NXOpen.Part= theSession.Parts.WorkDim displayPart As NXOpen.Part= theSession.Parts.DisplayDim lw As ListingWindow = theSession.ListingWindowDim theUI As UI = UI.GetUI() 
Sub Main (ByVal args()AsString) 
	Dim attDesc AsString=NothingDim attPartNum AsString=NothingDim attWeight AsDouble=NothingDim attributeInfo As NXObject.AttributeInformation 
' -------------------' GET USER ATTRIBUTES' ------------------- 
	If workPart.HasUserAttribute("DESCRIPTION", NXObject.AttributeType.Any, -1)Then
		attributeInfo = workPart.GetUserAttribute("Description", NXObject.AttributeType.String, -1)
    		attDesc = attributeInfo.StringValueElse
		lw.WriteLine("Attribute 'DESCRIPTION' is not present")EndIf 
	If workPart.HasUserAttribute("Weight", NXObject.AttributeType.Any, -1)ThenDim aInfo As NXObject.AttributeInformation
		aInfo = workPart.GetUserAttribute("Weight", NXObject.AttributeType.Any, -1)
    		attWeight = aInfo.StringValueElse
		lw.WriteLine("Attribute 'Weight' is not present")
		attWeight =" "EndIf 
	attPartnum = workPart.Name 
' -----------------------------------------------------------------' CREATE FEATURE GROUP "ENGRAVE TEXT" AND MAKE FEATURE GROUP ACTIVE' ----------------------------------------------------------------- 
Dim markId1 As NXOpen.Session.UndoMarkId=Nothing
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Feature Groups") 
Dim activatefeaturegroupwithrollback1 AsBoolean=Nothing
activatefeaturegroupwithrollback1 = theSession.Preferences.Modeling.ActivateFeatureGroupWithRollback 
Dim featuresToGroup As Tag()=NothingDim theFeatureGroupTag As Tag =Nothing
theUfSession.Modl.CreateSetOfFeature("ENGRAVE TEXT", featuresToGroup, 0, 1, theFeatureGroupTag) 
	ForEach myFeature As Features.FeatureIn workPart.FeaturesIfTypeOf(myFeature)Is NXOpen.Features.FeatureGroupThenIf myFeature.FeatureType="FSET"And myFeature.Name="ENGRAVE TEXT"Then
                    		myFeature.MakeCurrentFeature()
				myFeature.SetGroupActive(True)EndIfEndIfNext 
' ---------------------------------------------------' SET PARAMETERS FOR CURVE SEL AND FACE OFFSET METHOD' --------------------------------------------------- 
Dim nullNXOpen_Features_Feature As NXOpen.Features.Feature=Nothing 
Dim aOCSBuilder1 As NXOpen.Features.AOCSBuilder=Nothing
aOCSBuilder1 = workPart.Features.CreateAocsBuilder(nullNXOpen_Features_Feature) 
Dim lawBuilder1 As NXOpen.GeometricUtilities.LawBuilder=Nothing
lawBuilder1 = aOCSBuilder1.Law 
Dim alongSpineBuilder1 As NXOpen.GeometricUtilities.AlongSpineBuilder=Nothing
alongSpineBuilder1 = lawBuilder1.AlongSpineData 
Dim unit1 As NXOpen.Unit=Nothing
unit1 = aOCSBuilder1.FilletRadius.Units 
Dim curveFitData1 As NXOpen.GeometricUtilities.CurveFitData=Nothing
curveFitData1 = aOCSBuilder1.CurveFitData 
Dim nullNXOpen_ScCollector As NXOpen.ScCollector=Nothing 
aOCSBuilder1.FaceCollector= nullNXOpen_ScCollector
 
aOCSBuilder1.OffsetDistType= NXOpen.Features.AOCSBuilder.OffsetDistanceType.Constant
aOCSBuilder1.OffsetDirectionOption= NXOpen.Features.AOCSBuilder.OffsetDirection.NormalToCurve
aOCSBuilder1.OffsetMode= NXOpen.Features.AOCSBuilder.OffsetType.Tangential
aOCSBuilder1.TrimMethod= NXOpen.Features.AOCSBuilder.Trim.WithinSection
aOCSBuilder1.ExtendMethod= NXOpen.Features.AOCSBuilder.Extend.WithinSection
aOCSBuilder1.TrimToFaceEdgesOption=False
aOCSBuilder1.ExtendToFaceOption= NXOpen.Features.AOCSBuilder.ExtendToFace.Boundary
aOCSBuilder1.RemoveSelfIntersections=True
aOCSBuilder1.AssociativeOutputOption=True
aOCSBuilder1.LawStringFlip=False
aOCSBuilder1.SplitCurveOption=True
aOCSBuilder1.OffsetDirectionOption= NXOpen.Features.AOCSBuilder.OffsetDirection.NormalToCurve 
aOCSBuilder1.FilletOption= NXOpen.Features.AOCSBuilder.FilletOptions.NoFillet
aOCSBuilder1.CurveOffsetType= NXOpen.Features.AOCSBuilder.CurveOffsetTypes.Value 
Dim nullNXOpen_Point As NXOpen.Point=Nothing 
aOCSBuilder1.ThroughPoint= nullNXOpen_Point
 
Dim objectList1 As NXOpen.ObjectList=Nothing
objectList1 = alongSpineBuilder1.SpinePointList
objectList1.Clear(NXOpen.ObjectList.DeleteOption.Delete) 
Dim origin1 As NXOpen.Point3d=New NXOpen.Point3d(0.0, 0.0, 0.0)Dim vector1 As NXOpen.Vector3d=New NXOpen.Vector3d(1.0, 0.0, 0.0)Dim direction1 As NXOpen.Direction=Nothing
direction1 = workPart.Directions.CreateDirection(origin1, vector1, NXOpen.SmartObject.UpdateOption.WithinModeling) 
aOCSBuilder1.ProjectPlaneNormal= direction1
 
Dim section1 As NXOpen.Section=Nothing
section1 = workPart.Sections.CreateSection(0.0094999999999999998, 0.01, 0.5) 
Dim nullNXOpen_Section As NXOpen.Section=Nothing 
Dim expressionSectionSet1 As NXOpen.ExpressionSectionSet=Nothing
expressionSectionSet1 = workPart.CreateExpressionSectionSet(nullNXOpen_Section, "2", "Length", 0) 
expressionSectionSet1.ItemFlipFlag=True
aOCSBuilder1.Offsets.Append(expressionSectionSet1) 
section1.SetAllowedEntityTypes(NXOpen.Section.AllowTypes.OnlyCurves) 
' ------------------------'   SELECT CURVE TO OFFSET' ------------------------ 
	Dim pickEdge As Edge
 
	If SelectEdge("Select Edge", pickEdge)= Selection.Response.CancelThenReturnEndIf 
Dim edges1(0)As NXOpen.Edge
edges1(0)= pickEdge
 
Dim edgeDumbRule1 As NXOpen.EdgeDumbRule=Nothing
edgeDumbRule1 = workPart.ScRuleFactory.CreateRuleEdgeDumb(edges1) 
section1.AllowSelfIntersection(False) 
Dim rules1(0)As NXOpen.SelectionIntentRule
rules1(0)= edgeDumbRule1
Dim nullNXOpen_NXObject As NXOpen.NXObject=Nothing 
Dim helpPoint1 As NXOpen.Point3d=New NXOpen.Point3d(-51.890018880214939, -40.000000000000043, 10.0)
section1.AddToSection(rules1, pickEdge, nullNXOpen_NXObject, nullNXOpen_NXObject, helpPoint1, NXOpen.Section.Mode.Create, False) 
expressionSectionSet1.Section= section1
 
' ----------------------' SELECT FACE FOR OFFSET' ---------------------- 
Dim scCollector1 As NXOpen.ScCollector=Nothing
scCollector1 = workPart.ScCollectors.CreateCollector() 
Dim pickFace As Face
SelectAFace("select a face", pickFace) 
	Dim faces1(0)As NXOpen.Face
	faces1(0)= pickFace
 
	Dim faceDumbRule1 As NXOpen.FaceDumbRule=Nothing
	faceDumbRule1 = workPart.ScRuleFactory.CreateRuleFaceDumb(faces1)Dim rules2(0)As NXOpen.SelectionIntentRule
	rules2(0)= faceDumbRule1
	scCollector1.ReplaceRules(rules2, False) 
	aOCSBuilder1.FaceCollector= scCollector1
	aOCSBuilder1.UpdateFaces() 
	Dim feature1 As NXOpen.Features.Feature=Nothing
	feature1 = aOCSBuilder1.CommitFeature()
	aOCSBuilder1.Destroy() 
' -------------------------------------------' INSERT TEXT 1 AND SEL OFFSET CURVE FOR TEXT' ------------------------------------------- 
Dim nullNXOpen_Features_Text As NXOpen.Features.Text=Nothing 
Dim textBuilder1 As NXOpen.Features.TextBuilder=Nothing
textBuilder1 = workPart.Features.CreateTextBuilder(nullNXOpen_Features_Text) 
textBuilder1.TextString=("WEIGHT: "& attWeight.ToString("0.00")&" kg")
textBuilder1.FrameOnPath.AnchorPosition.Expression.RightHandSide="50"
textBuilder1.Type= NXOpen.Features.TextBuilder.Types.OnFace
textBuilder1.PlanarFrame.Shear.RightHandSide="0"
textBuilder1.FrameOnPath.AnchorLocation= NXOpen.GeometricUtilities.FrameOnPathBuilder.AnchorLocationType.Left
textBuilder1.FrameOnPath.AnchorPosition.Expression.RightHandSide="5"
textBuilder1.FrameOnPath.Height.RightHandSide="5"
textBuilder1.PrintMarkThickness.RightHandSide="1"
textBuilder1.FrameOnPath.WScale=100.0
textBuilder1.FrameOnPath.Offset.RightHandSide="0"
textBuilder1.SelectFont("Arial", NXOpen.Features.TextBuilder.ScriptOptions.Western) 
Dim boundaryFaces1(-1)As NXOpen.FaceDim faceTangentRule1 As NXOpen.FaceTangentRule=Nothing
faceTangentRule1 = workPart.ScRuleFactory.CreateRuleFaceTangent(pickFace, boundaryFaces1, 0.5) 
Dim rules3(0)As NXOpen.SelectionIntentRule
rules3(0)= faceTangentRule1
textBuilder1.PlacementFaces.ReplaceRules(rules3, False) 
textBuilder1.OnFacePlacementProfile.SetAllowedEntityTypes(NXOpen.Section.AllowTypes.OnlyCurves) 
Dim features1(0)As NXOpen.Features.FeatureDim aOCS1 As NXOpen.Features.AOCS=CType(feature1, NXOpen.Features.AOCS) 
features1(0)= aOCS1
Dim line1 As NXOpen.Line=CType(aOCS1.FindObject("CURVE 1"), NXOpen.Line) 
Dim nullNXOpen_Curve As NXOpen.Curve=Nothing 
Dim curveFeatureTangentRule1 As NXOpen.CurveFeatureTangentRule=Nothing
curveFeatureTangentRule1 = workPart.ScRuleFactory.CreateRuleCurveFeatureTangent(features1, line1, nullNXOpen_Curve, False, 0.01, 0.5) 
textBuilder1.OnFacePlacementProfile.AllowSelfIntersection(True) 
Dim rules4(0)As NXOpen.SelectionIntentRule
rules4(0)= curveFeatureTangentRule1
Dim helpPoint2 As NXOpen.Point3d=New NXOpen.Point3d(-56.880335976917863, -6.0840221749458578e-14, 10.000000000000043)
textBuilder1.OnFacePlacementProfile.AddToSection(rules4, line1, nullNXOpen_NXObject, nullNXOpen_NXObject, helpPoint2, NXOpen.Section.Mode.Create, False) 
Dim nXObject1 As NXOpen.NXObject=Nothing
nXObject1 = textBuilder1.Commit() 
textBuilder1.Destroy() 
' -------------------------------------------' INSERT TEXT 2 AND SEL OFFSET CURVE FOR TEXT' ------------------------------------------- 
Dim textBuilder2 As NXOpen.Features.TextBuilder=Nothing
textBuilder2 = workPart.Features.CreateTextBuilder(nullNXOpen_Features_Text) 
Dim trimmedAttPartNum AsString= attPartnum.Remove( attPartnum.Length-5) 
textBuilder2.TextString= trimmedAttPartNum
textBuilder2.FrameOnPath.AnchorPosition.Expression.RightHandSide="50"
textBuilder2.Type= NXOpen.Features.TextBuilder.Types.OnFace
textBuilder2.PlanarFrame.Shear.RightHandSide="0"
textBuilder2.FrameOnPath.AnchorLocation= NXOpen.GeometricUtilities.FrameOnPathBuilder.AnchorLocationType.Left
textBuilder2.FrameOnPath.AnchorPosition.Expression.RightHandSide="5"
textBuilder2.FrameOnPath.Height.RightHandSide="5"
textBuilder2.PrintMarkThickness.RightHandSide="1"
textBuilder2.FrameOnPath.WScale=100.0
textBuilder2.FrameOnPath.Offset.RightHandSide="7"
textBuilder2.SelectFont("Arial", NXOpen.Features.TextBuilder.ScriptOptions.Western) 
Dim boundaryFaces2(-1)As NXOpen.FaceDim faceTangentRule2 As NXOpen.FaceTangentRule=Nothing
faceTangentRule1 = workPart.ScRuleFactory.CreateRuleFaceTangent(pickFace, boundaryFaces2, 0.5) 
Dim rules5(0)As NXOpen.SelectionIntentRule
rules5(0)= faceTangentRule1
textBuilder2.PlacementFaces.ReplaceRules(rules5, False) 
textBuilder2.OnFacePlacementProfile.SetAllowedEntityTypes(NXOpen.Section.AllowTypes.OnlyCurves) 
Dim features2(0)As NXOpen.Features.Feature
features2(0)= aOCS1
Dim line3 As NXOpen.Line=CType(aOCS1.FindObject("CURVE 1"), NXOpen.Line) 
Dim curveFeatureTangentRule2 As NXOpen.CurveFeatureTangentRule=Nothing
curveFeatureTangentRule2 = workPart.ScRuleFactory.CreateRuleCurveFeatureTangent(features2, line3, nullNXOpen_Curve, False, 0.01, 0.5) 
textBuilder2.OnFacePlacementProfile.AllowSelfIntersection(True) 
Dim rules6(0)As NXOpen.SelectionIntentRule
rules6(0)= curveFeatureTangentRule1
Dim helpPoint3 As NXOpen.Point3d=New NXOpen.Point3d(-56.880335976917863, -6.0840221749458578e-14, 10.000000000000043)
textBuilder2.OnFacePlacementProfile.AddToSection(rules6, line3, nullNXOpen_NXObject, nullNXOpen_NXObject, helpPoint3, NXOpen.Section.Mode.Create, False) 
Dim nXObject2 As NXOpen.NXObject=Nothing
nXObject2 = textBuilder2.Commit() 
textBuilder2.Destroy() 
' -------------------------------------------' INSERT TEXT 3 AND SEL OFFSET CURVE FOR TEXT' ------------------------------------------- 
Dim textBuilder3 As NXOpen.Features.TextBuilder=Nothing
textBuilder3 = workPart.Features.CreateTextBuilder(nullNXOpen_Features_Text) 
textBuilder3.TextString= attDesc
 
textBuilder3.FrameOnPath.AnchorPosition.Expression.RightHandSide="50"
textBuilder3.Type= NXOpen.Features.TextBuilder.Types.OnFace
textBuilder3.PlanarFrame.Shear.RightHandSide="0"
textBuilder3.FrameOnPath.AnchorLocation= NXOpen.GeometricUtilities.FrameOnPathBuilder.AnchorLocationType.Left
textBuilder3.FrameOnPath.AnchorPosition.Expression.RightHandSide="5"
textBuilder3.FrameOnPath.Height.RightHandSide="5"
textBuilder3.PrintMarkThickness.RightHandSide="1"
textBuilder3.FrameOnPath.WScale=100.0
textBuilder3.FrameOnPath.Offset.RightHandSide="14"
textBuilder3.SelectFont("Arial", NXOpen.Features.TextBuilder.ScriptOptions.Western) 
Dim boundaryFaces3(-1)As NXOpen.FaceDim faceTangentRule3 As NXOpen.FaceTangentRule=Nothing
faceTangentRule1 = workPart.ScRuleFactory.CreateRuleFaceTangent(pickFace, boundaryFaces3, 0.5) 
Dim rules7(0)As NXOpen.SelectionIntentRule
rules7(0)= faceTangentRule1
textBuilder3.PlacementFaces.ReplaceRules(rules7, False) 
textBuilder3.OnFacePlacementProfile.SetAllowedEntityTypes(NXOpen.Section.AllowTypes.OnlyCurves) 
Dim features3(0)As NXOpen.Features.Feature
features3(0)= aOCS1
Dim line4 As NXOpen.Line=CType(aOCS1.FindObject("CURVE 1"), NXOpen.Line) 
Dim curveFeatureTangentRule3 As NXOpen.CurveFeatureTangentRule=Nothing
curveFeatureTangentRule3 = workPart.ScRuleFactory.CreateRuleCurveFeatureTangent(features3, line4, nullNXOpen_Curve, False, 0.01, 0.5) 
textBuilder3.OnFacePlacementProfile.AllowSelfIntersection(True) 
Dim rules8(0)As NXOpen.SelectionIntentRule
rules8(0)= curveFeatureTangentRule3
Dim helpPoint4 As NXOpen.Point3d=New NXOpen.Point3d(-56.880335976917863, -6.0840221749458578e-14, 10.000000000000043)
textBuilder3.OnFacePlacementProfile.AddToSection(rules8, line4, nullNXOpen_NXObject, nullNXOpen_NXObject, helpPoint4, NXOpen.Section.Mode.Create, False) 
Dim nXObject3 As NXOpen.NXObject=Nothing
nXObject3 = textBuilder3.Commit() 
textBuilder3.Destroy() 
' ------------------------------' REVERSE OFFSET CURVE DIRECTION' ------------------------------Dim answer AsInteger= theUI.NXMessageBox.Show("Offset Curve Direction",
                     NXOpen.NXMessageBox.DialogType.Question, "Change Offset Curve Direction..?") 
	If answer =1Then 
		Dim editWithRollbackManager1 As NXOpen.Features.EditWithRollbackManager=Nothing
		editWithRollbackManager1 = workPart.Features.StartEditWithRollbackManager(aOCS1, markId1) 
		Dim aOCSBuilder2 As NXOpen.Features.AOCSBuilder=Nothing
		aOCSBuilder2 = workPart.Features.CreateAocsBuilder(aOCS1) 
		Dim taggedObject2 As NXOpen.TaggedObject=Nothing
		taggedObject2 = aOCSBuilder2.Offsets.FindItem(0) 
		Dim expressionSectionSet2 As NXOpen.ExpressionSectionSet=CType(taggedObject2, NXOpen.ExpressionSectionSet) 
		section1.ReverseDirectionOfLoop(0) 
		Dim flipDirection1 AsBoolean=Nothing
		flipDirection1 = aOCSBuilder2.UpdateSectionData(section1) 
		Dim feature2 As NXOpen.Features.Feature=Nothing
		feature2 = aOCSBuilder2.CommitFeature() 
		editWithRollbackManager1.UpdateFeature(False)
		editWithRollbackManager1.Stop()
		editWithRollbackManager1.Destroy()EndIf 
' ----------------------------------------------' SELECT TEXT TO EXTRUDE & BODY TO SUBTRACT FROM' ---------------------------------------------- 
Dim EdgeOBJ as Edge = pickEdge
Dim text2SubFrom As Body = EdgeOBJ.GetBody() 
Dim extrudeBuilder1 As NXOpen.Features.ExtrudeBuilder=Nothing
extrudeBuilder1 = workPart.Features.CreateExtrudeBuilder(nullNXOpen_Features_Feature) 
Dim section5 As NXOpen.Section=Nothing
section5 = workPart.Sections.CreateSection(0.0094999999999999998, 0.01, 0.5) 
extrudeBuilder1.Section= section5
 
Dim targetBodies1(0)As NXOpen.BodyDim nullNXOpen_Body As NXOpen.Body=Nothing
targetBodies1(0)= nullNXOpen_Body
 
extrudeBuilder1.BooleanOperation.SetTargetBodies(targetBodies1)
extrudeBuilder1.Limits.StartExtend.Value.RightHandSide="0.5"
extrudeBuilder1.Limits.EndExtend.Value.RightHandSide="-0.5"
extrudeBuilder1.BooleanOperation.Type= NXOpen.GeometricUtilities.BooleanOperation.BooleanType.Subtract 
Dim targetBodies2(0)As NXOpen.Body 
targetBodies2(0)= text2SubFrom
 
extrudeBuilder1.BooleanOperation.SetTargetBodies(targetBodies2) 
Dim smartVolumeProfileBuilder1 As NXOpen.GeometricUtilities.SmartVolumeProfileBuilder=Nothing
smartVolumeProfileBuilder1 = extrudeBuilder1.SmartVolumeProfile 
Dim features4(0)As NXOpen.Features.FeatureDim text1 As NXOpen.Features.Text=CType(nXObject1, NXOpen.Features.Text)
features4(0)= text1
Dim features5(0)As NXOpen.Features.FeatureDim text2 As NXOpen.Features.Text=CType(nXObject2, NXOpen.Features.Text)
features5(0)= text2
Dim features6(0)As NXOpen.Features.FeatureDim text3 As NXOpen.Features.Text=CType(nXObject3, NXOpen.Features.Text)
features6(0)= text3
 
Dim curveFeatureRule1 As NXOpen.CurveFeatureRule=Nothing
curveFeatureRule1 = workPart.ScRuleFactory.CreateRuleCurveFeature(features4)Dim curveFeatureRule2 As NXOpen.CurveFeatureRule=Nothing
curveFeatureRule2 = workPart.ScRuleFactory.CreateRuleCurveFeature(features5)Dim curveFeatureRule3 As NXOpen.CurveFeatureRule=Nothing
curveFeatureRule3 = workPart.ScRuleFactory.CreateRuleCurveFeature(features6) 
Dim rules9(0)As NXOpen.SelectionIntentRule
rules9(0)= curveFeatureRule1
Dim helpPoint5 As NXOpen.Point3d=New NXOpen.Point3d(0.0, 0.0, 0.0)
section5.AddToSection(rules9, nullNXOpen_NXObject, nullNXOpen_NXObject, nullNXOpen_NXObject, helpPoint5, NXOpen.Section.Mode.Create, False) 
Dim rules10(0)As NXOpen.SelectionIntentRule
rules10(0)= curveFeatureRule2
Dim helpPoint6 As NXOpen.Point3d=New NXOpen.Point3d(0.0, 0.0, 0.0)
section5.AddToSection(rules10, nullNXOpen_NXObject, nullNXOpen_NXObject, nullNXOpen_NXObject, helpPoint6, NXOpen.Section.Mode.Create, False) 
Dim rules11(0)As NXOpen.SelectionIntentRule
rules11(0)= curveFeatureRule3
Dim helpPoint7 As NXOpen.Point3d=New NXOpen.Point3d(0.0, 0.0, 0.0)
section5.AddToSection(rules11, nullNXOpen_NXObject, nullNXOpen_NXObject, nullNXOpen_NXObject, helpPoint7, NXOpen.Section.Mode.Create, False) 
Dim origin3 As NXOpen.Point3d=New NXOpen.Point3d(-46.124198330506573, 7.7841263299248453, 10.0)Dim vector2 As NXOpen.Vector3d=New NXOpen.Vector3d(0.0, 0.0, 1.0)Dim direction2 As NXOpen.Direction=Nothing
direction2 = workPart.Directions.CreateDirection(origin3, vector2, NXOpen.SmartObject.UpdateOption.WithinModeling) 
extrudeBuilder1.Direction= direction2
extrudeBuilder1.ParentFeatureInternal=False 
Dim feature3 As NXOpen.Features.Feature=Nothing
feature3 = extrudeBuilder1.CommitFeature() 
extrudeBuilder1.Destroy() 
'--------------------'Clear Selection List'-------------------- 
Dim partCleanup As NXOpen.PartCleanup=Nothing
partCleanup = theSession.NewPartCleanup()
partCleanup.TurnOffHighlighting=True
partCleanup.DoCleanup()
partCleanup.Dispose() 
EndSub 
Function SelectAFace(ByVal prompt AsString, ByRef selObj As Face)As Selection.Response 
        Dim theUI As UI = UI.GetUIDim title AsString="pickFace"Dim includeFeatures AsBoolean=FalseDim keepHighlighted AsBoolean=TrueDim selAction As Selection.SelectionAction= Selection.SelectionAction.ClearAndEnableSpecificDim cursor As Point3d
        Dim scope As Selection.SelectionScope= Selection.SelectionScope.AnyInAssemblyDim selectionMask_array(0)As Selection.MaskTriple 
        With selectionMask_array(0).Type= UFConstants.UF_solid_type.SolidBodySubtype= UFConstants.UF_UI_SEL_FEATURE_ANY_FACEEndWith 
        Dim resp As Selection.Response= theUI.SelectionManager.SelectObject(prompt, _
         title, scope, selAction, _
         includeFeatures, keepHighlighted, selectionMask_array, _
         selObj, cursor)If resp = Selection.Response.ObjectSelectedOrElse resp = Selection.Response.ObjectSelectedByNameThenReturn Selection.Response.OkElseReturn Selection.Response.CancelEndIf 
EndFunction 
Function SelectEdge(ByVal prompt AsString, ByRef selObj As TaggedObject)As Selection.Response 
        Dim theUI As UI = UI.GetUIDim title AsString="pickEdge"Dim includeFeatures AsBoolean=FalseDim keepHighlighted AsBoolean=TrueDim selAction As Selection.SelectionAction= Selection.SelectionAction.ClearAndEnableSpecificDim cursor As Point3d
        Dim scope As Selection.SelectionScope= Selection.SelectionScope.WorkPartDim selectionMask_array(0)As Selection.MaskTriple 
        With selectionMask_array(0).Type= UFConstants.UF_solid_type.SolidBodySubtype= UFConstants.UF_UI_SEL_FEATURE_ANY_EDGEEndWith 
        Dim resp As Selection.Response= theUI.SelectionManager.SelectTaggedObject(prompt, _
         title, scope, selAction, _
         includeFeatures, keepHighlighted, selectionMask_array, _
         selobj, cursor)If resp = Selection.Response.ObjectSelectedOrElse resp = Selection.Response.ObjectSelectedByNameThenReturn Selection.Response.OkElseReturn Selection.Response.CancelEndIf 
EndFunction 
PublicFunction GetUnloadOption(ByVal dummy AsString)AsInteger 
        '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'------------------------------- 
EndFunction 
EndModule

Viewing all articles
Browse latest Browse all 783

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>