Quantcast
Viewing all 783 articles
Browse latest View live

Export Facetbodies as .stl - reduced quality

Hello everyone,

I've the necessity to export Facetbodies as .stl.
Normally I use

File>Export>stl...

that open a "Rapid Prototyping" GUI that allow me to choose some output quality parameters (triangle Tol, Adjancy Tol...) and the export process is very fast. Moreover output file are quite small...

How could use that command from journaling?

I've only found a different solution on https://community.plm.automation.siemens.com/t5/NX-Programming-Customiza... but that script simply export the facetbody as-is, not with a "reduced quality"

Many thanks
Gabriele


Tagged object to point

Hi,

I created a block styler and it has many blocks. I have a "super point" block. I can get the Tagged object, but I need to convert it to a "specify point" type.
I have never used a "super point" block, but I need it, since it allows me to select a few. The "specify point" selects only one point.
How can I convert nxopen.taggedobject to nxopen.point?
I have such a code on with, but it does not work on line where faa[jj] = obj[1]->Coordinates(); (error: NULL pointer)

PropertyList *sp = superPoint0->GetProperties();
std::vector<TaggedObject *> tivi = sp->GetTaggedObjectVector("SelectedObjects");
std::vector<Point *> obj(8);
Point3d faa[8];
for (unsigned int jj = 0; jj < tivi.size(); ++jj)
{
	obj[jj] = dynamic_cast<NXOpen::Point*>(tivi[jj]);
	faa[jj] = obj[1]->Coordinates();
}

Nx open documents

Hello All

I am beginner to Nx customization(using c# code),please any provide the site or any good documents to learn the nxopen and how to search a API & code for Nx applications.

Thank you
Reagrds
Naveen

identify source & mirror body

HOW to SUPPRESS A FEATURE GROUP

HI Guys,

I´m having some trouble to identify how can I supress a feature group and those members.
I´m trying to replace the find object from journal and I´m not sure with class I can use for it.

Dim featureGroup1 As Features.FeatureGroup = CType(workPart.Features.FindObject("FEATURE_SET(60)"), Features.FeatureGroup)

Thanks in Advanced.
TH

Overall size of part

Hello Experts

My requirements are

Macro need to find the overall size of part like (length width thickness) and same data will be copy to excel.

Thank you

Select all button in block styler dialog

Hi,

I'm trying to find way how to create button (selectAllNotes) to add all object with specific parametres (for example all annotation notes in layer 41) to previous selection block (selectNotes) in block styler dialog.

    Public Function update_cb(ByVal block As NXOpen.BlockStyler.UIBlock) As Integer
        Try
            Dim theWorkPart As Part = theSession.Parts.Work
            Dim theUfSession As UFSession = UFSession.GetUFSession
            Dim curDrg As Drawings.DrawingSheet = theWorkPart.DrawingSheets.CurrentDrawingSheet
            Dim drfViews As Drawings.DraftingView() = curDrg.SheetDraftingViews.ToArray()
 
            If block Is selectNotes Then
                '---- Enter your code here -----
 
            ElseIf block Is selectAllNotes Then
 
                Dim visibleObjects() As DisplayableObject
                visibleObjects = theWorkPart.Views.WorkView.AskVisibleObjects
 
                For Each memView As Drawings.DraftingView In drfViews
                    Dim dispObjs As DisplayableObject() = theWorkPart.Views.WorkView.AskVisibleObjects()
 
                    For Each aDispObj As DisplayableObject In dispObjs
 
                        If TypeOf aDispObj Is Annotations.Note Then
 
                            If aDispObj.Layer = 41 Then
 
                                selectNotes.SetSelectedObjects(aDispObj)
                            End If
                        End If
                    Next
                Next

Problem is, that SetSelectedObjects needs to value of type TaggedObject(), but aDispObj is type DisplayableObject. Can I convert somehow type of this object?

Get Environment Variable

How can I get a system variable in my journaling code?
I'm not asking for the Windows System Variable like UGII_BASE_DIR. That can easily be done by something like this.

Dim baseDir As String = Environment.GetEnvironmentVariable("UGII_BASE_DIR")

I'm looking for the variables which is listed in ugii_env.dat or ugii_env_ug.dat. Like for instance UGCHECKMATE_USER_DIR


Export all Model View with Reset Orientation to specific folder

Hi,

Please help me to create a journal to Export all Model View with Reset Orientation to user specific folder.

Thanks,
Suresh G

C++ can't hit break points

Hi Everyone,

I write most of my NXOpen functions in .NET but recently we have decided to look at using C++ as that is what all our CFD/FEA meshing tools use as well as most other areas in the company.

I have a new tool that I have written in C++ but the odd thing is when I attach to process and debug it in a native NX12 session, it hits the break points. When I do the same for a version of NX12 through TeamCentre it runs fine and completes, but doesn't hit any breakpoints.

My other .Net tools all debug fine with a TeamCentre session of NX12.

I am using external libraries, namely cpr, json_spirit and Boost.

I have run out of ideas. Does anyone have any thoughts one what might be causing it to not attach properly?

Thanks
Nick

Convergent Faced Body - triangles selection

Hi Everyone,

I'm dealing with Convergent Faced Body on NX.
It is possible to select single ( or multiple) triangle on a Convergent Faced Body without using UI.Styler (I've no licence for use it)?

I've tried to use a classic Mask_Triple, but I've not found a way to select a NXOpen.ConvergentFacet...
Do you have any solution for it?

Many thanks
Gabriele

Get projected distance at motion(Kinematics)

Dear All,

I'm trying to measure projection distance at motion, I just found out measure method by using Measure on Slove. but this is very slow. so I added uf measure command at articulationControl1.
Joint 1 : Slide
Joint 2 : Revolve
Joint 3 : Slide

but the result of distacnes are same for each position. I think the distance is design position(Orjinal position), so how can I solve this issue? How can I access the each position and measure proejction distance(ex. Y axis)?

Thansk

Imports System
Imports NXOpen
Imports NXOpen.UF

Module NXJournal

Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work
Dim myufs As NXOpen.UF.UFSession = NXOpen.UF.UFSession.GetUFSession
Dim displayPart As NXOpen.Part = theSession.Parts.Display

Sub Main(ByVal args() As String)

Dim height_lower_Limit As Double = -20
Dim height_upper_Limit As Double = 25
Dim Slide_foremost_Limit As Double = 200
Dim Silde_rearmost_Limit As Double = -60

Dim tilt_lower_limit As Double = -3.5
Dim tilt_upper_limit As Double = 3.5

Dim Slide_count_step As Double = 100
Dim Height_count_tep As Double = 45
Dim Tilt_count_step As Double = 3.5

Dim motionSolution1 As NXOpen.Motion.MotionSolution = CType(workPart.MotionManager.MotionSolutions.FindObject("Solution_1"), NXOpen.Motion.MotionSolution)

Dim articulationControl1 As NXOpen.Motion.ArticulationControl = Nothing
articulationControl1 = motionSolution1.GetArticulationControl()
theSession.MotionSession.PostProcess.SetInterferenceOption(False)

theSession.MotionSession.PostProcess.SetMeasureOption(False)
theSession.MotionSession.PostProcess.SetSpeed(100000)
theSession.MotionSession.PostProcess.SetTraceOption(False)

theSession.MotionSession.PostProcess.SetStopOnEventOption(False)

articulationControl1.ActiveView = NXOpen.Motion.ActiveView.All

articulationControl1.Delay = 0

articulationControl1.JointsLimits = True

Dim Select_1() As TaggedObject = Nothing
Dim Select_2() As TaggedObject = Nothing

Select_1 = Nothing
Select_2 = Nothing
SelectObjects("First Objects", Select_1)
SelectObjects("Second Objects", Select_2)

Dim Select_one As TaggedObject = Nothing
Dim Select_two As TaggedObject = Nothing
Select_one = Select_1(0)
Select_two = Select_2(0)

'Track slide joint
Dim TrackSlideTag(0) As NXOpen.Motion.Joint
Dim TrackSlideJoint As NXOpen.Motion.Joint = CType(workPart.MotionManager.Joints.FindObject("J001"), NXOpen.Motion.Joint)
TrackSlideTag(0) = TrackSlideJoint
Dim TrackSlideDisplacement(0) As Double
Dim TrackSlideDisplacementUnit(0) As NXOpen.Unit
Dim unit1 As NXOpen.Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), NXOpen.Unit)
TrackSlideDisplacementUnit(0) = unit1

'Height Slide joint
Dim HeightSlideTag(0) As NXOpen.Motion.Joint
Dim HeightSlideJoint As NXOpen.Motion.Joint = CType(workPart.MotionManager.Joints.FindObject("J008"), NXOpen.Motion.Joint)
HeightSlideTag(0) = HeightSlideJoint
Dim HeightSlideDisplacement(0) As Double
Dim HeightSlideDisplacementunit(0) As NXOpen.Unit
Dim unit2 As NXOpen.Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), NXOpen.Unit)
HeightSlideDisplacementunit(0) = unit2

'Tilt revolue joint
Dim TiltRotationTag(0) As NXOpen.Motion.Joint
Dim TiltRotationJoint As NXOpen.Motion.Joint = CType(workPart.MotionManager.Joints.FindObject("J006"), NXOpen.Motion.Joint)
TiltRotationTag(0) = TiltRotationJoint
Dim TiltRotationDisplacement(0) As Double
Dim TiltRotationDisplacementunit(0) As NXOpen.Unit
Dim unit3 As NXOpen.Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), NXOpen.Unit)

TiltRotationDisplacementunit(0) = unit3
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

For Slide As Double = Silde_rearmost_Limit To Slide_foremost_Limit Step Slide_count_step
TrackSlideDisplacement(0) = Slide
articulationControl1.ArticulationSolve(TrackSlideTag, TrackSlideDisplacement, TrackSlideDisplacementUnit)

For height As Double = height_lower_Limit To height_upper_Limit Step Height_count_tep
HeightSlideDisplacement(0) = height
articulationControl1.ArticulationSolve(HeightSlideTag, HeightSlideDisplacement, HeightSlideDisplacementunit)

For Tilt As Double = tilt_lower_limit To tilt_upper_limit Step Tilt_count_step
TiltRotationDisplacement(0) = Tilt
articulationControl1.ArticulationSolve(TiltRotationTag, TiltRotationDisplacement, TiltRotationDisplacementunit)
articulationControl1.Stop()

Dim accuracy As Double = 0.99999
Dim pt1 As Point3d = Nothing
Dim pt2 As Point3d = Nothing

Dim theMeasurement As NXOpen.Measurement = NXOpen.Session.GetSession.Measurement
Dim Measure_result As Double

Measure_result = theMeasurement.GetMinimumDistance(Select_one, Select_two, pt1, pt2, accuracy)

Dim line1 As NXOpen.Line = workPart.Curves.CreateLine(pt1, pt2)
Guide.InfoWriteLine(" First Object Tag : "& Select_one.ToString)
Guide.InfoWriteLine(" Second Tag : "& Select_two.ToString)
Guide.InfoWriteLine("Slide positon : "& Slide)
Guide.InfoWriteLine("Height positon : "& height)
Guide.InfoWriteLine(" Distance: "& Measure_result)

Next Tilt

Next height

Next Slide

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

theSession.MotionSession.PostProcess.ListMeasure()

articulationControl1.Finish()

theSession.CleanUpFacetedFacesAndEdges()

End Sub

Function SelectObjects(ByVal prompt As String, ByRef selObj() As TaggedObject) As Selection.Response

Dim theUI As NXOpen.UI = NXOpen.UI.GetUI
Dim title As String = "Selection"
Dim includeFeatures As Boolean = False
Dim keepHighlighted As Boolean = False
Dim selAction As Selection.SelectionAction =
Selection.SelectionAction.ClearAndEnableSpecific

Dim scope As Selection.SelectionScope = Selection.SelectionScope.AnyInAssembly
Dim selectionMask_array(7) As Selection.MaskTriple

With selectionMask_array(0)
.Type = UFConstants.UF_point_type
.Subtype = 0
.SolidBodySubtype = 0
End With

With selectionMask_array(1)
.Type = UFConstants.UF_line_type
.Subtype = 0
.SolidBodySubtype = 0
End With
With selectionMask_array(2)
.Type = UFConstants.UF_circle_type
.Subtype = 0
.SolidBodySubtype = 0
End With

With selectionMask_array(3)
.Type = UFConstants.UF_face_type
.Subtype = 0
.SolidBodySubtype = 0
End With

With selectionMask_array(4)
.Type = UFConstants.UF_solid_type
.Subtype = 0
.SolidBodySubtype = 0
End With

With selectionMask_array(5)
.Type = UFConstants.UF_plane_type
.Subtype = 0
.SolidBodySubtype = 0
End With
With selectionMask_array(6)
.Type = UFConstants.UF_datum_plane_type
.Subtype = 0
.SolidBodySubtype = 0
End With

With selectionMask_array(7)
.Type = UFConstants.UF_spline_type
.Subtype = 0
.SolidBodySubtype = 0
End With

Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObjects(prompt, title, scope, selAction, includeFeatures, keepHighlighted, selectionMask_array, selObj)

If resp = Selection.Response.Ok Then
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If

End Function

Function Get_infor_line(ByVal input_value As Integer, ByVal nxobject As NXObject) As Point3d
Dim stPt(2) As Double
Dim edPt(2) As Double
Dim junk3(2) As Double
Dim junk1 As Double
myufs.Modl.AskCurveProps(nxobject.Tag, input_value, stPt, junk3, junk3, junk3, junk1, junk1)
Dim newStartPoint As Point3d = New Point3d(stPt(0), stPt(1), stPt(2))
Return newStartPoint

End Function

Structure Original_curves
Dim Type_Str As String
Dim Output_object As Line
Dim Index_cnt As Integer
Dim Start_Point As Point3d
Dim Mid_Point As Point3d
Dim End_Point As Point3d
Dim Checked_status As Boolean
End Structure

End Module

Execute Auto Balloon via VB.NET

I am unable to write a code in VB.NET to execute "Auto Balloon" command.

As this function is not supported to be recorded as journal kindly direct me how to achieve "Auto Balloon" using VB.NET.

Create feature Slot/groove/pad/pocket

Hi,
can anyone suggest how to create a Slot/groove/pad/pocket using NXopen/ugopen.
preferably C/C++ , vb is also fine.
I searched for class in NXopen C++ documentation, but I didn't get. Can anyone come up with steps to create a anyone of the above said features.
NX journal option, do not record these feature, but I would like to write.

Thank you

Get point coordinate from linked wave point

Dear all
I'm trying to get coordinate information from linked wavepoint. Could you please let me know that approach method ?

Thanks


Remove orphan product interface

Hi all.

Is there any way to remove all orphan status product interfaces from work part..
I tried to record but it's being limited to one object which is selected at the time of journal record but I want to cycle through all the product interfaces in work part n delete the orphan status interfaces...

Importing Gcode as Geometry

I'm reprogramming a part in NX that already has gcode generated from another programming platform. I'm hoping to import the gcode into NX as curve geometry to help understand what the current program is doing. I'm not looking to use the curves for programming any tool paths. Also, the model I am working with was exported for the other platform, so the coordinate systems should match up. In looking at the code I have, it appears to be entirely G0, G1, G2, and G3. Some cutter comp is also there. Anyone know of any journals that perform this function?

Position over ride components in Assembly

Hi,

I am trying to position over ride the components in Assembly Level for arrangement requirements. Initially I am removing position override in all components inside the assembly, Then I override the components only in component groups. I am getting error "A dimension subscript for an array attribute was out of range or invalid". Also it corrupts the part. After this most NX commands throwing the same error. I have to close the session without saving the part to clear this issue. A little guidance would be helpful.

Option Strict Off
Imports System
Imports System.IOImports System.Windows.FormsImports System.DrawingImports System.Drawing.ImagingImports System.CollectionsImports System.Runtime.InteropServicesImports NXOpen
Imports NXOpen.GeometricUtilitiesImports NXOpen.UFImports NXOpen.AssembliesImports NXOpenUI
Imports System.Collections.GenericImports System.Threading 
 
Module PositionOverRide
 
    Dim theSession As Session = Session.GetSession()Dim workPart As Part = theSession.Parts.WorkDim displayPart As Part = theSession.Parts.DisplayDim theUI As UI = UI.GetUIDim ufs As UFSession = UFSession.GetUFSessionDim lw As ListingWindow = theSession.ListingWindow 
    Sub Main() 
        'Remove Position Override for all assembly components Dim Mycomponent As ComponentAssembly = workPart.ComponentAssembly
            RemovePositionOverride(Mycomponent.RootComponent, 0) 
        'ArrangementOptions.IndividuallyPositioned and Position override for each assembliesDim MyCompList As List(Of Component)=New List(Of Component)ForEach compGroup As ComponentGroup In workPart.ComponentGroupsForEach Mycomp As Component In compGroup.GetComponents
                MyCompList.Add(Mycomp)NextNext
        lw.WriteLine(MyCompList.Count) 
        ForEach Mycomp As Component In MyCompList
            TryDim nullAssemblies_Component As Assemblies.Component=Nothing
                Mycomp.EstablishPositionOverride(nullAssemblies_Component)Dim MyObj(0)As NXObject
                MyObj(0)= Mycomp
                Dim assembliesParameterPropertiesBuilder1 As AssembliesParameterPropertiesBuilder = workPart.PropertiesManager.CreateAssembliesParameterPropertiesBuilder(MyObj)
                assembliesParameterPropertiesBuilder1.Arrangements= Assemblies.AssembliesParameterPropertiesBuilder.ArrangementOptions.IndividuallyPositionedDim NxObject1 As NXObject
                NxObject1 = assembliesParameterPropertiesBuilder1.Commit()
                assembliesParameterPropertiesBuilder1.Destroy() 
            Catch ex As NXException
                lw.WriteLine(ex.ErrorCode&" : "& ex.Message)EndTryNext 
    EndSub 
    Sub RemovePositionOverride(ByVal comp As Component, ByVal indent AsInteger) 
        ForEach child As Component In comp.GetChildren()If child.GetChildren.Length<>0ThenTryDim nullAssemblies_Component As Assemblies.Component=Nothing
                    child.RemovePositionOverride(nullAssemblies_Component)Catch ex As NXException
 
                EndTryElseTryDim nullAssemblies_Component As Assemblies.Component=Nothing
                    child.RemovePositionOverride(nullAssemblies_Component)Catch ex As NXException
                EndTryEndIf
            RemovePositionOverride(child, indent +1)NextEndSub 
 
EndModule

Delete

Export all Model View with Reset Orientation to specific folder

Hi,

Please help me to create a journal to Export all Model View with Reset Orientation to user specific folder.

Thanks,
Suresh G

Viewing all 783 articles
Browse latest View live


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