Showing results for 
Search instead for 
Did you mean: 

How to create poles for B-surface


Hello, everyone:


Are there any functions in NXOpen which can be used to create poles for B-surface?

It seems that the poles for B-surface is generated automatically by journal without using any functions.


Thanks a lot


Re: How to create poles for B-surface

Siemens Phenom Siemens Phenom
Siemens Phenom

I'm not sure what you mean by "create the poles".


If you want to get the poles of an existing b-surface, you can use NXOpen.UF.UFModl.AskBsurf.


Alternatively, use NX to record creation of a Point Set feature, and choose Type = "Face Points", and Face Points by B-surface poles. The recorded code will show you how to use the PolePointSetBuilder object, from which you can get the poles.


Or, if you have SNAP, then, from a B-surface face, you can get a Snap.Geom.Surface.Bsurface object, and this has a Poles property.


Re: How to create poles for B-surface


Hello, today I recorded "point set ", the code is pasted in the below.

After executing the code, the poles can be created as point set.

But I still have two questions:

1. In the code below, I haven't found any functions which can output the coordinates of the points.

Do I still need to use other functions to output the coordinates of the point? I want to output the coordinate of the code into a txt file.


2. Actually, my final goal is to first read degrees and the number of patches for a B-surface from a txt file and use Nx to calculate and output "the coordiantes of the poles of the B-surface" according to the given degree and number of patches . I am still searching for a function which can do the work.


Thank you for your reply!

I started to learn NXopen 2 weeks ago. I am still a freshman of NXopen !!

Hope to receive your answer






#include <uf_defs.h>
#include <NXOpen/NXException.hxx>
#include <NXOpen/Session.hxx>
#include <NXOpen/BasePart.hxx>
#include <NXOpen/Builder.hxx>
#include <NXOpen/DisplayableObject.hxx>
#include <NXOpen/Expression.hxx>
#include <NXOpen/ExpressionCollection.hxx>
#include <NXOpen/Face.hxx>
#include <NXOpen/FaceDumbRule.hxx>
#include <NXOpen/Features_Extrude.hxx>
#include <NXOpen/Features_FeatureCollection.hxx>
#include <NXOpen/Features_PointSetBuilder.hxx>
#include <NXOpen/Features_PointSetFacePercentageBuilder.hxx>
#include <NXOpen/Features_PointSetFacePercentageBuilderList.hxx>
#include <NXOpen/NXObject.hxx>
#include <NXOpen/NXObjectList.hxx>
#include <NXOpen/ObjectList.hxx>
#include <NXOpen/Part.hxx>
#include <NXOpen/PartCollection.hxx>
#include <NXOpen/Point.hxx>
#include <NXOpen/PointList.hxx>
#include <NXOpen/Preferences_PartModeling.hxx>
#include <NXOpen/Preferences_PartPreferences.hxx>
#include <NXOpen/ScCollector.hxx>
#include <NXOpen/ScRuleFactory.hxx>
#include <NXOpen/Section.hxx>
#include <NXOpen/SelectDisplayableObjectList.hxx>
#include <NXOpen/SelectFace.hxx>
#include <NXOpen/SelectObject.hxx>
#include <NXOpen/SelectionIntentRule.hxx>
#include <NXOpen/Session.hxx>
#include <NXOpen/TaggedObject.hxx>
#include <NXOpen/Unit.hxx>
#include <NXOpen/BodyCollection.hxx>
#include <NXOpen/Body.hxx>

using namespace NXOpen;

extern "C" DllExport int ufusr_ask_unload()
return (int)NXOpen::Session::LibraryUnloadOptionImmediately;

extern "C" DllExport void ufusr(char *param, int *retCode, int paramLen)
NXOpen::Session *theSession = NXOpen::Session::GetSession();
NXOpen::Part *workPart(theSession->Parts()->Work());
NXOpen::Part *displayPart(theSession->Parts()->Display());
// ----------------------------------------------
// Menu: Insert->Datum/Point->Point Set...
// ----------------------------------------------

NXOpen::Features::PointSet *nullNXOpen_Features_PointSet(NULL);

NXOpen::Features::PointSetBuilder *pointSetBuilder1;
pointSetBuilder1 = workPart->Features()->CreatePointSetBuilder(nullNXOpen_Features_PointSet);




NXOpen::Unit *nullNXOpen_Unit(NULL);
NXOpen::Expression *expression1;
expression1 = workPart->Expressions()->CreateSystemExpressionWithUnits("50", nullNXOpen_Unit);

//*** read all the faces
BodyCollection *bc = workPart->Bodies();
std::vector<Face *>faces;
Body *body;
for (BodyCollection::iterator it = bc->begin(); it != bc->end(); ++it)
body = (*it);
faces = body->GetFaces();
//*** finish reading the surface

NXOpen::FaceDumbRule *faceDumbRule1;
faceDumbRule1 = workPart->ScRuleFactory()->CreateRuleFaceDumb(faces);

std::vector<NXOpen::SelectionIntentRule *> rules1(1);
rules1[0] = faceDumbRule1;
pointSetBuilder1->MultipleFaceCollector()->ReplaceRules(rules1, false);

NXOpen::NXObject *nXObject1;
nXObject1 = pointSetBuilder1->Commit();




Re: How to create poles for B-surface


Given a point set feature, use the .GetEntities feature object method to access the points that belong to the point set feature.


The following example code will search the work part's features and report the points of any "point set" features.


Code is written in VB.

Option Strict Off
Imports System
Imports NXOpen

Module Module1

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        If IsNothing(theSession.Parts.Work) Then
            'active part required
        End If

        Dim workPart As Part = theSession.Parts.Work
        Dim lw As ListingWindow = theSession.ListingWindow

        Const undoMarkName As String = "NXJ journal"
        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

        For Each myFeature As Features.Feature In workPart.Features
            If TypeOf (myFeature) Is Features.PointSet Then
                lw.WriteLine(".GetFeatureName: " & myFeature.GetFeatureName)

                Dim myPoints() As NXObject = myFeature.GetEntities

                For Each tempPt As Point In myPoints

            End If



    End Sub

    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        'Unloads the image immediately after execution within NX
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

    End Function

End Module