Showing results for 
Search instead for 
Do you mean 
Reply

use NXopen to generate poles according to degrees and patches

Hello, everyone,

 

By using Xform, We can generate poles for a surface according to the value of “degree” and "patches" defined in Xform. 

But how can I generate poles in NXopen C++ if I know the "surface", "degree" value and "patches" value.

I used journal to record the codes used by Xform.  Xform generated the poles without using any functions. It just outputed the position of the poles and putted it into ControlpoleManager. 

 

I want to develop a plug-in which can show the position of poles, calculated according to the given values of degree and patches of each surface

But I don't know how to calculate the poles of a surface according to the values of degree and patches.

 

 

6 REPLIES

Re: use NXopen to generate poles according to degrees and patches

I described three ways to get b-surface poles in my answer to your other recent question. You don't have to know the degrees or the number of patches.

山田
yamada

Re: use NXopen to generate poles according to degrees and patches

[ Edited ]

> I want to develop a plug-in which can show the position of poles, calculated

> according to the given values of degree and patches of each surface

 

Information --> B-surface does that already.

 

Or, alternatively, you can choose Edit Object Display, expand the Wireframe Display

portion of the dialog, and choose "Show Poles". This will make the poles a permanent part of the display of the face. There are some options in Preferences --> Modeling Preferences --> Analysis that let you control how poles are displayed.

山田
yamada

Re: use NXopen to generate poles according to degrees and patches

山田,

 

Thank you for your reply

I will work on ExtractFaceBuilder today and convert all faces to B-Surface first.

And then I will do "Show poles"

I hope, in the end, I can

1. automatically convert all faces into B-surface 

2. change the degrees and patches of some surfaces by reading a text input file.

3. output the control points of each surfaces calculated by NX.

 

Your reply is really a good motivition for me(a beginner) to continue my work on NXopen c++.

Thanks a lot 

Re: use NXopen to generate poles according to degrees and patches

What data is in the text file that you will read?

 

 

山田
yamada

Re: use NXopen to generate poles according to degrees and patches

the coordiante and weight of control points of the B-surfaces 

 

Re: use NXopen to generate poles according to degrees and patches

Here in the following, are the functions which can convert any surfaces into B-surface.

Tomorrow, I will try to output the coordinates of control points and trimmed information of each Bsurface.

I hope tomorrow, I can find some functions which can show and output the trimmed information

 

//function which can convert an arbitrary surface into a B-surface

NXOpen::Features::Feature *nullNXOpen_Features_Feature(NULL);
	NXOpen::Part *workPart(theSession->Parts()->Work());
	NXOpen::Features::ExtractFaceBuilder *extractFaceBuilder1;
	extractFaceBuilder1 = workPart->Features()->CreateExtractFaceBuilder(nullNXOpen_Features_Feature);

	extractFaceBuilder1->SetFaceOption(NXOpen::Features::ExtractFaceBuilder::FaceOptionTypeSingleFace);

	extractFaceBuilder1->SetSurfaceType(NXOpen::Features::ExtractFaceBuilder::FaceSurfaceTypeGeneralBSurface);

	extractFaceBuilder1->SetParentPart(NXOpen::Features::ExtractFaceBuilder::ParentPartTypeWorkPart);

	extractFaceBuilder1->SetAssociative(true);

	extractFaceBuilder1->SetFixAtCurrentTimestamp(true);

	extractFaceBuilder1->SetHideOriginal(true);

	extractFaceBuilder1->SetDeleteHoles(false);

	extractFaceBuilder1->SetInheritDisplayProperties(false);

	extractFaceBuilder1->SetType(NXOpen::Features::ExtractFaceBuilder::ExtractTypeFace);

	//I assume that there exists only one body
	//BodyCollection *bc = workPart->Bodies();
	//Body *bodypart;
	//BodyCollection::iterator it = bc->begin();
	//bodypart = (*it);

	bool added1;
	added1 = extractFaceBuilder1->ObjectToExtract()->Add(facetemp);
	NXObject *nXObject1;
	nXObject1 = extractFaceBuilder1->Commit();
	NXOpen::Features::BodyFeature *featureExtract(dynamic_cast<NXOpen::Features::BodyFeature *>(nXObject1));
	std::vector<NXOpen::Body *> bodiesExtract = featureExtract->GetBodies();
	std::vector<NXOpen::Face* > faces; // here I assume there exists only one body
	faces = bodiesExtract[0]->GetFaces();
	return faces[0];
 

 

void MyClass::do_it()
{

	Part *workPart = theSession->Parts()->Work();
	BodyCollection *bc = workPart->Bodies();
	std::vector<Face *>faces;
	std::vector<Face*> extractedfaces;
	Body *body;
	//search
	BodyCollection::iterator it = bc->begin();
	body = (*it);
	faces = body->GetFaces();

	for (int i = 0; i < faces.size();i++)
	extractedfaces.push_back ( extractbody(faces[i]));
	
}