dataFile and addByInsert do Not Work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hi,
dataFile and addByInsert do Not Work.
I don't know the exact syntax to declare the datafile.
My test code is given below.
Please correct my code.
Thurai
/////////////////////////////////////////////////////////////
#include <Core/CoreAll.h>
#include <Fusion/FusionAll.h>
#include <CAM/CAMAll.h>
#include <time.h>
using namespace adsk::core;
using namespace adsk::fusion;
using namespace adsk::cam;
using namespace std;
Ptr<Application> app;
Ptr<UserInterface> ui;
extern "C" XI_EXPORT bool run(const char* context)
{
Ptr<Application> app = Application::get();
if (!app)
return false;
ui = app->userInterface();
if (!ui)
return false;
Ptr<Documents> docs = app->documents();
if (!docs)
return false;
// Create a document.
Ptr<Document> doc = docs->add(DocumentTypes::FusionDesignDocumentType);
if (!doc)
return false;
Ptr<Design> design = app->activeProduct();
if (!design)
return false;
Ptr<Component> rootComp = design->rootComponent();
if (!rootComp)
return false;
Ptr<Sketches> sketches = rootComp->sketches();
if (!sketches)
return false;
Ptr<ConstructionPlane> xyPlane;
xyPlane = rootComp->xYConstructionPlane();
if (!xyPlane)
return false;
Ptr<Point3D> insertPoint = Point3D::create(0.0, 0.0, 0.0);
Ptr<DataFile> dataFile;
ui->messageBox(" Before dataFile ");
// Set the value of the property, where value_var is a string.
bool returnValue = dataFile->name("E:\\Backups\\Fusion 360\\FeatureExtrude.f3d");
if(!returnValue)
return false;
ui->messageBox(" After dataFile ");
Ptr<Matrix3D> insertMatrix = Matrix3D::create();
Ptr<Vector3D> vector = Vector3D::create(insertPoint->x(), insertPoint->y(), insertPoint->z());
insertMatrix->translation(vector);
Ptr<Occurrence> occ = rootComp->occurrences()->addByInsert(dataFile, insertMatrix, true);
return true;
}
#ifdef XI_WIN
#include <windows.h>
BOOL APIENTRY DllMain(HMODULE hmodule, DWORD reason, LPVOID reserved)
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif // XI_WIN