Jump to content

Help creating a csv of raw data by feature


---
 Share

Recommended Posts

Going to a PCM class in a few months, but I'm trying some projects on my own. Hoping to get some help.

I want to create a csv of raw data of a feature in inches. The export points function works, but it's always in metric, and it is space separated, which creates extra work on my end.

My idea is to get the total number of points in the feature, and loop through each point, grab the x, y, z, convert to inches, add to file, end loop at the total number of points.

Questions:

Is there syntax to grab the total number of points from a feature? If so, what is the syntax to get point 1, then point 2, etc.

Is this method worth trying? Or is there a simpler way that I'm not thinking of?

Thanks. I appreciate any help.

Edited
Link to comment
Share on other sites

seems possible, if you have 2024 or later there are some hidden built in excel functions for PCM I believe.

good luck.

Link to comment
Share on other sites

Found an old post where Eric Moberg shared this:

getNominal("feature").numberOfNomPoints

But I believe it only works with curves. I might play around creating curves for the export.

Link to comment
Share on other sites

path="C:\Users\xxxxx\Documents\TXT Data\"
name=getRecordHead("planid")+"_"+getRecordHead("partnbinc")
ext=".csv"
dirpath=path+name+ext
addToFile(dirpath,"X,"+" "+"Y,"+" "+"Z,")
conv=(1/25.4)
for i=1 to 8
	px=getActual("H05_SPD"+i).x *conv
	py=getActual("H05_SPD"+i).y *conv
	pz=getActual("H05_SPD"+i).z *conv
	addToFile(dirpath,px+","+py+","+pz)
next i

The above works as a proof of concept... Unfortunately, only for this very particular group of 8 individual points. I would still like this code to be able to:

syntax for the amount of points for any specific feature. Freeforms, curves, planes, etc. Not sure if it is possible.

Access of the x, y, z of each individual point. Hopefully by being able to loop.

Removing the "d" at the end of every coordinate number.

I can't seem to find anything for the above in the PCM manual included in the documentation provided by Zeiss. Right now, I'm just going through Moberg's post history, hoping to find some hidden nuggets haha.

 

  • Like! 1
Link to comment
Share on other sites

path="C:\Users\xxxx\Documents\TXT Data\"
name=getRecordHead("planid")+"_"+getRecordHead("partnbinc")
ext=".csv"
dirpath=path+name+ext
addToFile(dirpath,"X,"+" "+"Y,"+" "+"Z,")
conv=(1/25.4)
curvep=getNominal("H10_CN139_N to P").numberOfNomPoints
for i=1 to curvep
	px=getActualCurvePointCoord("H10_CN139_N to P","X",i) *conv
	py=getActualCurvePointCoord("H10_CN139_N to P","Y",i) *conv
	pz=getActualCurvePointCoord("H10_CN139_N to P","Z",i) *conv
	addToFile(dirpath,px+","+py+","+pz)
next i

Curve works. Now if I can get Freeforms to work I'll call this a success.

  • Like! 1
Link to comment
Share on other sites

Tip : I often measure curves and recall into FreeFormSurfaces. Sometimes it's easier to control the paths this way. 

Link to comment
Share on other sites

Please sign in to view this quote.

I'm having real trouble getting any usable syntax for Free Form Surfaces. I can't extract the total number of points of a singular FFS, and even with a fixed value, I can't find a way to grab individual point values.

I thought this would work since it is directly from the function and parameter list:

getActualProfilePointCoord( 'FreeformSurfaceForm', 'X',point number )

But I always get the error "Internal error: "Message not understood: #identifierWithoutIndex"

Clearly still have a lot to learn. Appreciate the support though.

Oh and for the above code regarding curves, I found a way to remove the lowercase d after every coordinate value. below is the new code snippet.

namefeat="Feature_X"
path="C:\Users\xxxxxxx\Documents\TXT Data\"
name=getRecordHead("planid")+"_"+namefeat+"_"+getRecordHead("partnbinc")
ext=".csv"
dirpath=path+name+ext
addToFile(dirpath,"X,"+" "+"Y,"+" "+"Z")
conv=(1/25.4)
curvep=getNominal(namefeat).numberOfNomPoints
for i=1 to curvep
	px=formatL((getActualCurvePointCoord(namefeat,"X",i)*conv),8,7)
	py=formatL((getActualCurvePointCoord(namefeat,"Y",i)*conv),8,7)
	pz=formatL((getActualCurvePointCoord(namefeat,"Z",i)*conv),8,7)
	addToFile(dirpath,px+","+py+","+pz)
next i

Always open to tips/criticism. Thanks

Edited
  • Like! 2
Link to comment
Share on other sites

Please sign in to view this quote.

you're on the right track - keep it up; a whole new world opens up with PCM.

Regarding the code you posted :

getActualProfilePointCoord( 'FreeformSurfaceForm', 'X',point number )

should have double quotes like this I think :

getActualProfilePointCoord("FreeformSurfaceForm","X",1)

 

Edited
Link to comment
Share on other sites

You are correct, I tried that with a free form surface and that's where the: "Internal error: "Message not understood: #identifierWithoutIndex" came from. I've discovered that the particular function seems to only be compatible with a profile characteristic, not a free form surface feature, which is a bummer. My hope is to use this code in an automated cell, so I don't want to be creating characteristics that aren't necessary.

There has to be a way to get these free form attributes.

  • Like! 1
Link to comment
Share on other sites

Please sign in to view this quote.

You can't use a feature with getActualProfilePointCoord. It needs the characteristic FreeformSurfaceForm ->  image.png.d59c1e9ea14060866aed1ff6ee34b2a4.png

I didn't realized it first, too.

This is different to getActualCurvePointCoord.

To get the number of points, try 

getNominal("Freeform1").result.noPtOfAll 
getNominal("Freeform1").result.noPt  // don't know what's different compared to noPtOfAll (never used it). Maybe filter or outlier

 

 

  • Like! 1
Link to comment
Share on other sites

Please sign in to view this quote.

I appreciate the response. It also works if you throw it in a profile characteristic.

 

I seem to be having issues with the getNominal code at the bottom. I keep getting the error "Access attribute not allowed for access object. Access Attribute = noPtOfAll" I am on 2022, does it work in 2025? Or does it matter if the freeform consists of recalled points?

 

 

Link to comment
Share on other sites

Please sign in to view this quote.

My mistake, you have to use getActual combined with noPt.

getActual("Freiformfläche1").result.noPt  // number of points  used for calculation shown at the feature window (see picture)
getActual("Freiformfläche1").result.noPtOfAll // ???

image.png.969072496bad92efa95d570d5bf57116.png

Edited
  • Like! 3
Link to comment
Share on other sites

 Share

×
×
  • Create New...