Hi Michael,
In order to modify the PointImportFile script, to add the name of the text file to the object create (a curve), would the final line of code below do the job?
Or is there a better example?
Thank you,
- Brian
code: /
Code from _ImportObj.htm:
objName = moi.filesystem.getFileNameFromPath(objPath);
objName = objName.substr(0, objName.lastIndexOf('.'));
faceobj=scale3d.calculate();
moi.geometryDatabase.addObjects(faceobj);
// if ( normalize ) if (scale > 1) { objName = objName + " ["+scale+":1]" }
// else if (scale < 1) { objName = objName + " [1:"+Math.round(100/scale)/100+"]" }
if (errors>0) objName = objName + " err:"+errors;
faceobj.setProperty( 'name', objName);
***************
Code from ImportPointFile.js:
function ImportPointFile()
{
var filename = moi.filesystem.getOpenFileName( 'Choose a point file', 'Point files (*.txt, *.xyz, *.csv)|*.txt;*.xyz;*.csv|All files (*.*)|*.*' );
if ( filename == '' )
return; // User canceled.
***************
Other code from ImportPointFile.js:
else
ObjectList = GetCurve( ImportAs, PointList, CurveEnd );
ObjectList.setProperty( 'selected', true );
moi.geometryDatabase.addObjects( ObjectList );
***************
Proposed code to add???:
objName = filename.substr(0, filename.lastIndexOf('.'));
ObjectList.setProperty( 'name', objName);
I would also like the whereabouts of an example of "bulk selection" of filenames to import, if possible?
|