Quantcast
Channel: NX Journaling - Journaling / NXOpen API
Viewing all 787 articles
Browse latest View live

How to create a script that will count features in a model

$
0
0

I haven't written a real script in NX in a very long time and I'm hoping someone can share some knowledge. Thanks for your time.

I have a model that has thousands of holes and sometimes thousands of slots. I want to create a script that will allow me to easily count the number of holes or slots.

More than likely there will be other holes in the model, so it's important that the user be able to refine their search criteria, by referring to a specific feature or a specific diameter or range of diameters (diam 2.0 - 2.2).

Please Help. :)


Passing argument into dll

$
0
0

Hi,

I am trying to pass an argument into a NXOPen dll program. But when I try to access args, it is of length 2 but with no value inside. Here's my menuscript file and the vb code. Is there something I am missing here?

BUTTON TAG_GROUP
LABEL tag Face From Group
ACTIONS tagFromGroup("TAG_GROUP")
 Function Startup(ByVal args As String()) As Integer
 
        Dim theSession As Session = Session.GetSession()
        Dim theUI As UI = UI.GetUI()
        Dim theUfSession As UFSession = UFSession.GetUFSession()
 
 
        Select Case args(0)
            Case "TAG_GROUP"
 
        End Select
 
        Return 0
    End Function

Object Names and structure context

$
0
0

Hello everyone!
Recently I have made a journal which - amongst other things - defines an object name to a point, especially a routing control point (RCP).
Manually I achieve this by right-clicking on an RCP, selecting "properties", choosing the "General" tab and entering a "Name".
Programmatically, I do it like this:
                selectedRCPs(0).SetName(TextStr)

Either way I am running into a difficulty, because in my use case there is typically an assembly structure involved that looks like this:

+ Collecting ASM
: + ASM 1 (containing an RCP to be named)
: + ASM 2 (containing another RCP to be named identically)
: + ASM n (and so forth...)

What I intend to achieve is having the "Collecting ASM" as Displayed part and also Work part, then naming the several RCP objects.

But, of course, this happens in the context of "Collecting ASM" and hence the names are available in this context only. If I look at the same RCP in "it's own" ASM, it is not named.
I was prepared to see this when it comes to attributes, but I didn't expect it for object names. Now I became a bit smarter ;-)

So I am now looking for a way to propagate such an object name into the "origin context" of that specific object.
Have I succeeded in explaining this?

Does anyone have a clue or even a code example on how this can be achieved?

Thanks a lot,

UdoMM

DELETE Physical Property in Physical Properties (NX CAE)

$
0
0

Hi

Physical property is not set forth in Mesh Collectors(shell property). I want to search for and delete them. But, I don't know with the journal.

Please help me

How to get co-ordinate value (X and Y) of drafting curve

$
0
0

Hello,

I have created one block. After that one sketch on top surface which contains one line. then i have created baseview of that model in drawing.
So now I want the co-ordinates of the single line which is draftingcurve in drawing.
But i am not able to get the X value in this case.

So how to get the X value ?

I have used below code :

Option Strict Off
Imports NXOpen
Imports NXOpen.UI
Imports NXOpen.UF
Imports NXOpen.Utilities
Imports NXOpen.Drafting
 
 
Module module1
 
    Dim theSession As Session
    Dim workPart As Part
    Dim displayPart As Part
    Dim ufs As UFSession
    Dim theUI As UI
    Dim dwgShtBld As Drawings.DrawingSheetBuilder
    Dim ufsession As UFSession
 
    Sub Main()
 
        Dim theSession As Session = Session.GetSession()
        Dim workPart As Part = theSession.Parts.Work
        Dim theSection As Section = workPart.Sections.CreateSection()
        Dim point As Double
 
        Dim baseView1 As Drawings.BaseView = CType(workPart.DraftingViews.FindObject("Right@2"), Drawings.BaseView)
        MsgBox(baseView1.Name)
        baseView1.Expand()
        Dim draftingBody1 As Drawings.DraftingBody = CType(workPart.DraftingViews.FindObject("Right@2").DraftingBodies.FindObject("  0"), Drawings.DraftingBody)
 
 
        Dim Curves As CurveCollection = workPart.Curves
 
        For Each draftingCurve1 As Drawings.DraftingCurve In draftingBody1.DraftingCurves
 
            MsgBox(draftingCurve1.Name)
            MsgBox(CStr(draftingCurve1.NameLocation.Y))
 
        Next
 
 
    End Sub
 
    Public Function GetUnloadOption(ByVal dummy As String) As Integer
 
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
 
    End Function
End Module
 
 
 

Mold Wizard Customization & Window Behavior

$
0
0

Is there any way to incorporate a Nx Open .dll within mold wizard? Ideally, to create a new button that would allow program execution without exiting mold wizard?

If not, is there a way to execute a Nx Open .dll within another NX window/command that would return to the Nx window/command without exiting it? I am talking about the behavior that is present in the measure commands(Measure distance, angle, diameter, etc) and blank objects command that allows you to execute within another command in NX and allow you to return to it without exiting.

Project Curve : Update undo happened.

$
0
0

I am attempting to project a series of curves onto a sheet body. I grabbed a code sample on GTAC that matched close to something the journal recorder gave me, and the code kind of works.

For some reason, all of my projected curves appear as if they get projected correctly, and then offset from the part surface back towards the original geometry.

I also need to project along a line. I have tried using project along a vector in the code(see the commented out lines), but then I get an update undo happens and no curve.

Here is the link for the gtac code:
https://solutions.industrysoftware.automation.siemens.com/view.php?sort=...

:    Function ProjectCurves(ByRef toProj()As Curve, ByRef projOnto()As Face, ByVal crvLine AsLine)As Curve() 
        Dim markId1 As Session.UndoMarkId
        markId1 = nxSes.SetUndoMark(Session.MarkVisibility.Visible, "Project Curve") 
        Dim nullFeatures_Feature As Features.Feature=Nothing 
        Dim projectCurveBuilder1 As Features.ProjectCurveBuilder
        projectCurveBuilder1 = wrkPrt.Features.CreateProjectCurveBuilder(nullFeatures_Feature) 
        projectCurveBuilder1.BridgedGapSize=0.0393700787401575 
        projectCurveBuilder1.Tolerance=0.001 
        'projectCurveBuilder1.ProjectionDirectionMethod = Features.ProjectCurveBuilder.DirectionType.AlongVector 
        projectCurveBuilder1.AngleToProjectionVector.RightHandSide="0" 
        'Dim direction1 As Direction'direction1 = wrkPrt.Directions.CreateDirection(crvLine, Sense.Forward, SmartObject.UpdateOption.WithinModeling)'projectCurveBuilder1.ProjectionVector = direction1'projectCurveBuilder1.ProjectionOption = Features.ProjectCurveBuilder.ProjectionOptionType.ProjectBothSides 
 
        projectCurveBuilder1.BridgedGapSize=0.0393700787401575 
        projectCurveBuilder1.SectionToProject.DistanceTolerance=0.001 
        projectCurveBuilder1.SectionToProject.ChainingTolerance=0.00095 
        projectCurveBuilder1.SectionToProject.SetAllowedEntityTypes(Section.AllowTypes.CurvesAndPoints) 
        Dim curveDumbRule1 As CurveDumbRule
        curveDumbRule1 = wrkPrt.ScRuleFactory.CreateRuleCurveDumb(toProj) 
        projectCurveBuilder1.SectionToProject.AllowSelfIntersection(True) 
        Dim rules1(0)As SelectionIntentRule
        rules1(0)= curveDumbRule1
        Dim nullNXObject As NXObject =Nothing 
        Dim helpPoint1 As Point3d =New Point3d(0.0, 0.0, 0.0)
        projectCurveBuilder1.SectionToProject.AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section.Mode.Create, False) 
        Dim scCollector1 As ScCollector
        scCollector1 = wrkPrt.ScCollectors.CreateCollector() 
        Dim faceDumbRule1 As FaceDumbRule
        faceDumbRule1 = wrkPrt.ScRuleFactory.CreateRuleFaceDumb(projOnto) 
        Dim rules2(0)As SelectionIntentRule
        rules2(0)= faceDumbRule1
        scCollector1.ReplaceRules(rules2, False) 
        Dim added1 AsBoolean
        added1 = projectCurveBuilder1.FaceToProjectTo.Add(scCollector1) 
        Dim nXObject1 As Features.ProjectCurve
        nXObject1 = projectCurveBuilder1.Commit() 
        projectCurveBuilder1.Destroy() 
        Dim curveList As ArrayList =New ArrayList
        ForEach aCurve As NXObject In nXObject1.GetEntities()
            curveList.Add(aCurve)Next 
        Return curveList.ToArray(GetType(Curve)) 
    EndFunction<\vbnet> 

Open Component Location


offset curve in face and tube commands

$
0
0

Hello, I am trying to following actions by journal.

User offsets a curve in face. And this action triggers a tube command. Nx automatically makes a 4mm radius tube with this offsetted curve.

I recorded the below journal for this but it looks so complicated for me. Can u help me on this?

' NX 8.0.2.2''Option Strict OffImports System
Imports NXOpen
 
Module NXJournal
Sub Main
 
Dim theSession As Session = Session.GetSession()Dim workPart As Part = theSession.Parts.Work 
Dim displayPart As Part = theSession.Parts.Display 
' ----------------------------------------------'   Menu: Insert->Curve from Curves->Offset in Face...' ----------------------------------------------Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start") 
Dim nullFeatures_Feature As Features.Feature=Nothing 
 
IfNot workPart.Preferences.Modeling.GetHistoryModeThenThrow(New Exception("Create or edit of a Feature was recorded in History Mode but playback is in History-Free Mode."))EndIf 
Dim aOCSBuilder1 As Features.AOCSBuilder
aOCSBuilder1 = workPart.Features.CreateAocsBuilder(nullFeatures_Feature) 
Dim section1 As Section
section1 = workPart.Sections.CreateSection(0.02413, 0.0254, 0.5) 
Dim section2 As Section
section2 = workPart.Sections.CreateSection(0.02413, 0.0254, 0.5) 
aOCSBuilder1.LawString= section2
 
Dim lawBuilder1 As GeometricUtilities.LawBuilder
lawBuilder1 = aOCSBuilder1.Law 
Dim expression1 As Expression
expression1 = lawBuilder1.StartValue 
Dim expression2 As Expression
expression2 = lawBuilder1.EndValue 
Dim expression3 As Expression
expression3 = lawBuilder1.Value 
Dim alongSpineBuilder1 As GeometricUtilities.AlongSpineBuilder
alongSpineBuilder1 = lawBuilder1.AlongSpineData 
Dim unit1 As Unit
unit1 = aOCSBuilder1.FilletRadius.Units 
Dim expression4 As Expression
expression4 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1) 
Dim expression5 As Expression
expression5 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1) 
Dim expression6 As Expression
expression6 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1) 
Dim expression7 As Expression
expression7 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1) 
Dim expression8 As Expression
expression8 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1) 
Dim expression9 As Expression
expression9 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1) 
Dim expression10 As Expression
expression10 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1) 
Dim expression11 As Expression
expression11 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1) 
Dim expression12 As Expression
expression12 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1) 
Dim expression13 As Expression
expression13 = aOCSBuilder1.FilletRadius 
Dim curveFitJoin1 As GeometricUtilities.CurveFitJoin
curveFitJoin1 = aOCSBuilder1.CurveFitJoinData 
Dim nullScCollector As ScCollector =Nothing 
aOCSBuilder1.FaceCollector= nullScCollector
 
aOCSBuilder1.TrimMethod= Features.AOCSBuilder.Trim.WithinSection 
aOCSBuilder1.ExtendMethod= Features.AOCSBuilder.Extend.WithinSection 
aOCSBuilder1.TrimToFaceEdgesOption=True 
aOCSBuilder1.ExtendToFaceOption= Features.AOCSBuilder.ExtendToFace.None 
aOCSBuilder1.AssociativeOutputOption=True 
aOCSBuilder1.OffsetMode= Features.AOCSBuilder.OffsetType.Chordal 
aOCSBuilder1.DistanceTolerance=0.0254 
aOCSBuilder1.OffsetDistType= Features.AOCSBuilder.OffsetDistanceType.Constant 
aOCSBuilder1.LawStringFlip=False 
aOCSBuilder1.OffsetDirectionOption= Features.AOCSBuilder.OffsetDirection.NormalToCurve 
aOCSBuilder1.FilletOption= Features.AOCSBuilder.FilletOptions.NoFillet 
aOCSBuilder1.RemoveSelfIntersections=True 
expression13.RightHandSide="5.0" 
Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Update Law Data") 
Dim objectList1 As ObjectList
objectList1 = alongSpineBuilder1.SpinePointList 
objectList1.Clear(ObjectList.DeleteOption.Delete) 
theSession.DeleteUndoMarksUpToMark(markId2, "Update Law Data", False) 
theSession.SetUndoMarkName(markId1, "Offset Curve in Face Dialog") 
section1.DistanceTolerance=0.0254 
section1.ChainingTolerance=0.02413 
section2.DistanceTolerance=0.0254 
section2.ChainingTolerance=0.02413 
aOCSBuilder1.Law.AlongSpineData.Spine.DistanceTolerance=0.0254 
aOCSBuilder1.Law.AlongSpineData.Spine.ChainingTolerance=0.02413 
aOCSBuilder1.Law.LawCurve.DistanceTolerance=0.0254 
aOCSBuilder1.Law.LawCurve.ChainingTolerance=0.02413 
section1.SetAllowedEntityTypes(Section.AllowTypes.OnlyCurves) 
Dim section3 As Section
section3 = workPart.Sections.CreateSection(0.02413, 0.0254, 0.5) 
Dim nullSection As Section =Nothing 
Dim expressionSectionSet1 As ExpressionSectionSet
expressionSectionSet1 = workPart.CreateExpressionSectionSet(nullSection, "10", "Length", 0) 
expressionSectionSet1.ItemFlipFlag=True 
aOCSBuilder1.Offsets.Append(expressionSectionSet1) 
section3.SetAllowedEntityTypes(Section.AllowTypes.OnlyCurves) 
Dim markId3 As Session.UndoMarkId
markId3 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "section mark") 
Dim markId4 As Session.UndoMarkId
markId4 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, Nothing) 
Dim edges1(0)As Edge
Dim brep1 As Features.Brep=CType(workPart.Features.FindObject("UNPARAMETERIZED_FEATURE(0)"), Features.Brep) 
Dim edge1 As Edge =CType(brep1.FindObject("EDGE * 30 * 72 {(-131.0784369105108,90.8147661098534,130.2393322029726)(-129.1705132344285,101.1513916918431,128.7226642755924)(-127.2474145210153,111.4697594143704,127.1047959202027) UNPARAMETERIZED_FEATURE(0)}"), Edge) 
edges1(0)= edge1
Dim edgeDumbRule1 As EdgeDumbRule
edgeDumbRule1 = workPart.ScRuleFactory.CreateRuleEdgeDumb(edges1) 
section3.AllowSelfIntersection(False) 
Dim rules1(0)As SelectionIntentRule
rules1(0)= edgeDumbRule1
Dim nullNXObject As NXObject =Nothing 
Dim helpPoint1 As Point3d =New Point3d(-129.910097463325, 97.1566454838592, 129.321340288346)
section3.AddToSection(rules1, edge1, nullNXObject, nullNXObject, helpPoint1, Section.Mode.Create, False) 
theSession.DeleteUndoMark(markId4, Nothing) 
expressionSectionSet1.Section= section3
 
Dim flipDirection1 AsBoolean
flipDirection1 = aOCSBuilder1.UpdateSectionData(section3) 
expressionSectionSet1.ItemValue.RightHandSide="10" 
theSession.DeleteUndoMark(markId3, Nothing) 
Dim scCollector1 As ScCollector
scCollector1 = workPart.ScCollectors.CreateCollector() 
Dim faces1(0)As Face
Dim face1 As Face =CType(brep1.FindObject("FACE 30 {(-120.6880204445295,100.4238543178286,130.5938141045439) UNPARAMETERIZED_FEATURE(0)}"), Face) 
faces1(0)= face1
Dim faceDumbRule1 As FaceDumbRule
faceDumbRule1 = workPart.ScRuleFactory.CreateRuleFaceDumb(faces1) 
Dim rules2(0)As SelectionIntentRule
rules2(0)= faceDumbRule1
scCollector1.ReplaceRules(rules2, False) 
aOCSBuilder1.FaceCollector= scCollector1
 
aOCSBuilder1.UpdateFaces() 
Dim markId5 As Session.UndoMarkId
markId5 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Offset Curve in Face") 
Dim feature1 As Features.Feature
feature1 = aOCSBuilder1.CommitFeature() 
theSession.DeleteUndoMark(markId5, Nothing) 
theSession.SetUndoMarkName(markId1, "Offset Curve in Face") 
section3.CleanMappingData() 
Dim expression14 As Expression = expressionSectionSet1.ItemValue 
aOCSBuilder1.Destroy() 
section1.Destroy() 
workPart.Expressions.Delete(expression5) 
workPart.Expressions.Delete(expression7) 
workPart.Expressions.Delete(expression8) 
workPart.Expressions.Delete(expression9) 
workPart.Expressions.Delete(expression10) 
workPart.Expressions.Delete(expression11) 
workPart.Expressions.Delete(expression12) 
workPart.Expressions.Delete(expression4) 
workPart.Expressions.Delete(expression6) 
' ----------------------------------------------'   Menu: Insert->Sweep->Tube...' ----------------------------------------------Dim markId6 As Session.UndoMarkId
markId6 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start") 
Dim tubeBuilder1 As Features.TubeBuilder
tubeBuilder1 = workPart.Features.CreateTubeBuilder(nullFeatures_Feature) 
tubeBuilder1.Tolerance=0.0254 
tubeBuilder1.OuterDiameter.RightHandSide="4" 
tubeBuilder1.InnerDiameter.RightHandSide="0" 
tubeBuilder1.BooleanOption.Type= GeometricUtilities.BooleanOperation.BooleanType.Subtract 
Dim targetBodies1(0)As Body
Dim nullBody As Body =Nothing 
targetBodies1(0)= nullBody
tubeBuilder1.BooleanOption.SetTargetBodies(targetBodies1) 
tubeBuilder1.OutputOption= Features.TubeBuilder.Output.SingleSegment 
theSession.SetUndoMarkName(markId6, "Tube Dialog") 
tubeBuilder1.PathSection.DistanceTolerance=0.0254 
tubeBuilder1.PathSection.ChainingTolerance=0.02413 
tubeBuilder1.PathSection.SetAllowedEntityTypes(Section.AllowTypes.OnlyCurves) 
Dim markId7 As Session.UndoMarkId
markId7 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "section mark") 
Dim markId8 As Session.UndoMarkId
markId8 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, Nothing) 
Dim features1(0)As Features.FeatureDim aOCS1 As Features.AOCS=CType(feature1, Features.AOCS) 
features1(0)= aOCS1
Dim arc1 As Arc =CType(aOCS1.FindObject("CURVE 1"), Arc) 
Dim nullCurve As Curve =Nothing 
Dim curveFeatureTangentRule1 As CurveFeatureTangentRule
curveFeatureTangentRule1 = workPart.ScRuleFactory.CreateRuleCurveFeatureTangent(features1, arc1, nullCurve, False, 0.02413, 0.5) 
tubeBuilder1.PathSection.AllowSelfIntersection(True) 
Dim rules3(0)As SelectionIntentRule
rules3(0)= curveFeatureTangentRule1
Dim helpPoint2 As Point3d =New Point3d(-118.970703579602, 102.731069056367, 130.498922740421)
tubeBuilder1.PathSection.AddToSection(rules3, arc1, nullNXObject, nullNXObject, helpPoint2, Section.Mode.Create, False) 
theSession.DeleteUndoMark(markId8, Nothing) 
theSession.DeleteUndoMark(markId7, Nothing) 
tubeBuilder1.BooleanOption.Type= GeometricUtilities.BooleanOperation.BooleanType.Subtract 
Dim targetBodies2(0)As Body
Dim body1 As Body =CType(workPart.Bodies.FindObject("UNPARAMETERIZED_FEATURE(0)"), Body) 
targetBodies2(0)= body1
tubeBuilder1.BooleanOption.SetTargetBodies(targetBodies2) 
Dim markId9 As Session.UndoMarkId
markId9 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Tube") 
Dim nXObject1 As NXObject
nXObject1 = tubeBuilder1.Commit() 
theSession.DeleteUndoMark(markId9, Nothing) 
theSession.SetUndoMarkName(markId6, "Tube") 
Dim expression15 As Expression = tubeBuilder1.OuterDiameter 
Dim expression16 As Expression = tubeBuilder1.InnerDiameter 
tubeBuilder1.Destroy() 
' ----------------------------------------------'   Menu: Tools->Journal->Stop Recording' ---------------------------------------------- 
EndSubEnd Module

Export Part with Class Selection

$
0
0

Hello,

i have some problems with the function: File --> Export --> Part
The part which i want to export is an "Extracted Face".
After some analysis with different journals in NX, i want to export the original part ("Extracted Face") without the points and lines which i added for the analysis.
I get the original part with: File --> Export --> Part --> Class Selection --> Select the Extracted Face
My problem: I can't find a way for the "Class Selection" in a journal.
Is that possible or is there another way to save the original part?

Thank you.
Johannes

New Here - Pull from Excel, change expression value, export measurements to Excel/text

$
0
0

New here and to journaling in general.

Trying to automate a process for a range of motion in a sketch (NX Motion doesn't support my objective). To get a start I recorded what the process I have for entering a value change into an expression, see below.

- expressions are setup in the part file

- use excel range to change 1 - 4 expressions (start with 1)

- update the sketch based on new stepped values for the expressions

- read and export N number of expressions measuring critical features to Excel / Text tab delimited.

Being new to this, I am trying to understand the base code functions. I see where my recorded input was entered, but I didn't have a way to export the measured expressions. Those won't be in the code.

' NX 7.5.5.4
' Journal created by kdo on Tue Aug 23 14:15:15 2016 Central Daylight Time
'
Option Strict Off
Imports System
Imports NXOpen

Module NXJournal
Sub Main

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

Dim displayPart As Part = theSession.Parts.Display

' ----------------------------------------------
' Menu: Tools->Expression...
' ----------------------------------------------
theSession.CleanUpFacetedFacesAndEdges()

theSession.CleanUpFacetedFacesAndEdges()

theSession.CleanUpFacetedFacesAndEdges()

Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Expression")

Dim expression1 As Expression = CType(workPart.Expressions.FindObject("Sheave_ax"), Expression)

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

workPart.Expressions.EditWithUnits(expression1, unit1, "0")

Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Update Expression Data")

Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.DoUpdate(markId2)

theSession.DeleteUndoMark(markId2, "Update Expression Data")

Dim markId3 As Session.UndoMarkId
markId3 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Expression")

theSession.CleanUpFacetedFacesAndEdges()

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

End Sub
End Module

Automation of Section Line

$
0
0

Hello,

I am trying to create journal for Section Line in NX 10.

I have made UDF of sketch and inserted in the model. Then in drafting I am trying to create section view by using the sketch. But i am not able to get the sketch(Extracted Curve) properties.

How to get the properties of Extracted Curve ?

Writing names on parts from attributes

$
0
0

Hello, Is it possibble to write a part name from the part's own attribute. I meant, A part will have an attribute it is called "name". And There will be an assembly which contains a lot of components and parts. And journal will recursively search their name attribute and write it on the part.

Symbols

$
0
0

Hi,

I am replacing the ballon symbols from custom symbols.
Tool is working fine when sheet is 1.
When I have a multiple sheets, tool is creating symbols on the displayed sheet.
Eg:-suppose on sheet1 I have 3 symbols, on sheet2 I have 2 symbols,& sheet2 is opened after executing the program all the symbols are getting creating on sheet2(5 symbols).Leaders,origins all information are fine.
I don't want to go for opening each sheet & closing :)
Thanks

Extract edge curves

$
0
0

Hi I am beginner in journaling.

I am trying to make journal for extracting curves from a body "All in view"

Can anyone help in writing a journal.

Thanks


Count Sketch Points, get them from sketch selection

$
0
0

Hello,
how to count points of selected sketch (i need those for iteration, cuz i want to create Axis Systems on those points) and how to get those points for creatin of AS.

Add Row in Table

$
0
0

HI

I am trying to add row in Table.
I am able to add the row in direction from bottom to top and I have used below code for that.

But i want to add row from top to bottom direction.
Please help..

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports Insert_View_SH
Imports System.Threading
Imports System.Reflection
Imports System.Collections.Generic
Imports NXOpen.Annotations
Module module11
    Dim theSession As Session
    Dim ufsession As UFSession
    Dim workPart As NXOpen.Part
    Dim displayPart As NXOpen.Part
    Dim dwgSheet As Drawings.DrawingSheet
    Dim dwgShtBld As Drawings.DrawingSheetBuilder
    Dim OH As Double
    Dim dwgSheetList As New List(Of String)
    Dim myTabNotes As New List(Of Annotations.TableSection)
    Dim myTabularNoteTags As New List(Of Tag)
    Dim numCols As Integer
    Dim numRows As Integer
    Dim cellTag As NXOpen.Tag
    Dim rowTag As NXOpen.Tag
    Dim theCellPrefs As UFTabnot.CellPrefs
    Dim colTag As Tag
    Dim startcellTag As Tag
    Dim endcellTag As Tag
    Dim RowHeight1() As Double
    Dim RowHeight2() As Double
 
  Sub Main()
 
        theSession = Session.GetSession()
        workPart = theSession.Parts.Work
        ufsession = ufsession.GetUFSession()
        displayPart = theSession.Parts.Display
 
        dwgShtBld = workPart.DrawingSheets.DrawingSheetBuilder(workPart.DrawingSheets.CurrentDrawingSheet)
 
        ' ----------------------------------------------
 
        If FindTabularNotes(myTabularNoteTags) = 0 Then
            'no tabular notes to process
            Return
        End If
 
        Dim k As Integer
 
        '--------------Get row height of each row------3columns
        For Each tableNote As Tag In myTabularNoteTags
            tableNote = myTabularNoteTags.Item(0)
            ufsession.Tabnot.AskNmRows(tableNote, numRows)
            ReDim RowHeight2(numRows)
            RowHeight2(0) = 7
            For i As Integer = 0 To numRows - 1
                ufsession.Tabnot.AskNthRow(tableNote, i, rowTag)
                ufsession.Tabnot.AskRowHeight(rowTag, RowHeight2(i + 1))
            Next
            Exit For
        Next
 
        '  -------------------------------------------------------------
        For Each tableNote As Tag In myTabularNoteTags
            tableNote = myTabularNoteTags.Item(0)
            For k = 0 To 0
                If k = 0 Then
                    Dim numRows As Integer
                    ufsession.Tabnot.AskNmRows(tableNote, numRows)
                    Dim numCols As Integer
                    ufsession.Tabnot.AskNmColumns(tableNote, numCols)
 
                    '------------------------------------------------------------
                    'For First row
                    '-------------------------------------------------------------
                    For i As Integer = 0 To 0
                        Dim rowTag As Tag
                        ufsession.Tabnot.AskNthRow(tableNote, i, rowTag)
                        ufsession.Tabnot.CreateRow(7, rowTag)
                        ufsession.Tabnot.AddRow(tableNote, rowTag, 0) 'UFConstants.UF_TABNOT_APPEND) '----- Adds at the top
 
                        For j As Integer = 0 To numCols - 1
                            ufsession.Tabnot.AskNthColumn(tableNote, j, colTag)
                            ufsession.Tabnot.AskCellAtRowCol(rowTag, colTag, cellTag)
                            If j = 0 Then
                                startcellTag = cellTag
                            ElseIf j = numCols - 1 Then
                                endcellTag = cellTag
                            End If
                            'get the current cell preferences
                            ufsession.Tabnot.AskCellPrefs(cellTag, theCellPrefs)
                            theCellPrefs.text_aspect_ratio = 0.68
                            'change the font preference setting
                            Dim fntMonoBT As Integer = workPart.Fonts.AddFont("Monospac821 BT", FontCollection.Type.Standard)
                            theCellPrefs.text_font = 8
                            theCellPrefs.text_height = 3.2
                            theCellPrefs.horiz_just = UFTabnot.Just.JustMiddle
                            theCellPrefs.vert_just = UFTabnot.Just.JustCenter
 
                            Dim LineType() As Integer = {4, 1, 5}     '------To change the linetype of border (Doted type)
                            theCellPrefs.bottom_line_cfw = LineType
                            theCellPrefs.right_line_cfw = LineType
                            'apply the new settings to the cell
                            ufsession.Tabnot.SetCellPrefs(cellTag, theCellPrefs)
                            ufsession.Tabnot.SetRowHeadCfw(rowTag, LineType) '----Sets only the extreme left border of a row -----
 
                            theCellPrefs.horiz_just = UFTabnot.Just.JustMiddle
                            theCellPrefs.vert_just = UFTabnot.Just.JustCenter
                            ufsession.Tabnot.SetCellPrefs(cellTag, theCellPrefs)
                        Next
                    Next
                End If
            Next
        Next
 
 
 
        For Each tableNote As Tag In myTabularNoteTags
            tableNote = myTabularNoteTags.Item(1)       '---For three columns table
            ufsession.Tabnot.AskNmRows(tableNote, numRows)
            For i = 0 To numRows - 1 ' - 2
                ufsession.Tabnot.AskNthRow(tableNote, i, rowTag)
                ufsession.Tabnot.SetRowHeight(rowTag, RowHeight2(i))
            Next
            Exit For
        Next
 
        dwgShtBld.Commit()
        dwgShtBld.Destroy()
 
 
 
    End Sub
 
	 Function FindTabularNotes(ByRef theTabNotes As List(Of Tag)) As Integer '----For after adding the table
        'myTabularNoteTags
 
        Dim tmpTabNote As NXOpen.Tag = NXOpen.Tag.Null
        Dim type As Integer
        Dim subtype As Integer
 
        theSession = Session.GetSession()
        workPart = theSession.Parts.Work
        ufsession = ufsession.GetUFSession()
        displayPart = theSession.Parts.Display
 
        Do
            ufsession.Obj.CycleObjsInPart(workPart.Tag, UFConstants.UF_tabular_note_type, tmpTabNote)
            If tmpTabNote = NXOpen.Tag.Null Then
                Continue Do
            End If
            If tmpTabNote <> NXOpen.Tag.Null Then
                ufsession.Obj.AskTypeAndSubtype(tmpTabNote, type, subtype)
                If subtype = UFConstants.UF_tabular_note_subtype Then
                    theTabNotes.Add(tmpTabNote)
                End If
            End If
        Loop Until tmpTabNote = NXOpen.Tag.Null
 
        Return theTabNotes.Count
 
    End Function
 
End Module
 

Make threaded hole

$
0
0

Hi all,

I'm write nxopen application in c++.

There is a way to make hole 'threaded hole' using nxopen API?

The problem is that if i'm recording journal the API of making threaded hole not exposed!

viewdependentstatus function in ufunc ?

Reading a text file from Nx to windows form application

$
0
0

HELLO again, Is it possible to read and write part list to a windows form application directly which is exported from Nx?

Viewing all 787 articles
Browse latest View live


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