Currently I am checking for and storing the eeh for each pod file using mdlscancriteria..
What if the user attaches a pod file after I have does this scan... Do I need to continously run this scan every time I want to run a process?
Is there a *_setfunction function that will notify me if a pod file was attached? That way, I could scan once, and any time a pod is attached, I can append to my array. Any thoughts would be great!
This is what I am currently using.. I would really like something more efficient.
POD_Files.clear(); ScanCriteriaP scP = mdlScanCriteria_create (); mdlScanCriteria_setModel(scP, ACTIVEMODEL); mdlScanCriteria_setReturnType (scP, MSSCANCRIT_ITERATE_ELMREF, false, true); mdlScanCriteria_setElemRefCallback (scP, ScanCrit_Locate_POD_Files, NULL); mdlScanCriteria_addSingleElementTypeTest (scP, EXTENDED_ELM); mdlScanCriteria_scan (scP, NULL, NULL, NULL); mdlScanCriteria_free (scP);
int ScanCrit_Locate_POD_Files (ElementRef elemRef,void* callbackArg, ScanCriteria* scP){ ElemHandle eh (elemRef, ACTIVEMODEL); PointCloudHandler* handlerP = dynamic_cast<PointCloudHandler*>(&eh.GetHandler ()); if (NULL != handlerP) { POINTCLOUDDATA.POD_Files.push_back(eh.GetElemRef()); } return SUCCESS; }
Unknown said:Is there a *_setfunction function that will notify me if a pod file was attached?
I can see why you would want to know that. Like attaching a reference, loading a point cloud is an asynchronous event that affects the state of a DGN model.
I don't see any event notification in the IPointCloudImporter (see the MicroStationAPI documentation). Nor do I see any SYSTEM_XXX events (see <mssystem.fdf>) that apply to point clouds.
Regards, Jon Summers LA Solutions
Jon,
Thanks for your responses.. That is what I figured in both cases. :(
Scan Criteria is the way to retrieve existing pointcloud attachments.
Getting informed when a pointcloud gets attached is tricky since it is a 106 element. Therefore it doesn't become a a pointcloud until an xAttribute is added to the 106 element.
So you need to monitor mdlChangeTrack_setFunction(CHANGE_TRACK_FUNC_XAttributeChanged, ...)
and look for when the following majorId is added: XATTRIBUTEID_PointCloudHandler
#include <msdefs.h>
hth,
Simon
Answer Verified By: Maury
Thanks Simon!
Simon,
I have added my setfunction
mdlChangeTrack_setFunction(CHANGE_TRACK_FUNC_XAttributeChanged, MdlMain_PODAttached);
void MdlMain_PODAttached(XAttributeHandleCP xAttr, ChangeTrackInfo *info, BoolInt *cantBeUndoneFlag){
printf("ID: %d Need: %d\n", info->idNumber, XATTRIBUTEID_PointCloudHandler);
}
Where can i find the majorID? the info->idNumber is returning 0
Thanks!
Unknown said: So you need to monitor mdlChangeTrack_setFunction(CHANGE_TRACK_FUNC_XAttributeChanged, ...) and look for when the following majorId is added: XATTRIBUTEID_PointCloudHandler
That seems substantially different from the idiomatic mdlSystem_setFunction used to catch reference attachment and new file events. Can we request a system callback that would let you provide something similar for a POD attachment event?
You need to check the HandlerId of the xAttribute.
xAttr->GetHandlerId().GetMajorId ()
You should also check the value of the minorId. There's no public XATTRIBUTEID define for that, but it should be easy to find out which value you should test for when you attached.
You should use the ChangeTrackInfo pointer to know which type of action occurred.
Thanks that works!