Skip to main content
1-Visitor
December 16, 2019
Question

Output feature points data

  • December 16, 2019
  • 2 replies
  • 3354 views

Hello,.I have problem,

I want to use toolkit get points data from pattern,how can I do?

點資料問題.PNG

 

 

Thanks and Regards

Roger

 

2 replies

15-Moonstone
December 16, 2019

Hi

 

if you want to get it from pattern head:

 

 

// feat could be from a selection
pfcFeature_ptr feat = pfcFeature::cast(selectionItem);
if (feat->getFeatType() == pfcFeatureType::pfcFEATTYPE_PATTERN_HEAD) {
	pfcFeaturePattern_ptr featpat = feat->GetPattern();

	if (featpat != NULL) {
		pfcFeatures_ptr feats = featpat->ListMembers();
		if (feats != NULL) {
			for (int j = 0; j < feats->getarraysize(); j++) {
				pfcFeatureType type = feats->get(j)->GetFeatType();
				if (type == pfcFeatureType::pfcFEATTYPE_DATUM_POINT) {
					pfcSelection_ptr sel = pfcCreateModelItemSelection(pfcModelItem::cast(feats->get(j)));
 // do whatever you want with your element
					data->ref_references->append(sel);
				}
			}
		}
	}
}

Br,

Eike

CAD_Roger1-VisitorAuthor
1-Visitor
December 17, 2019

hello,Eike

Can I use this method to export .txt file?

15-Moonstone
December 17, 2019

You can use it for everything with points. So it just get the pattern in and the points (inside of selections) out. So you could get the points out of the selections and then get the position out of the points.

 

You need to decide to which Coordinate system you want to recalculate the position (to be sure that it also work in Assemblies and if your main CS is not the Part root CS).

 

So in simplicity yes. That's what I do with these sniplet 🙂

 

Br,

Eike

December 17, 2019

search for a function ProUtilGeomitemDump in pt_examples UtilGeom.c, copy/paste code for PRO_POINT.

 

As Eike mentioned,

use ProPatternMembers get to get a ProArray of point features

use ProFeatureGeomitemGet to get ProGeomitem which is going to be a PRO_POINT

the rest is from pt_examples

do not forget to apply appropriate transformations.

 

HIH.

FV.