增加了参数设置,可恢复版本
This commit is contained in:
parent
6ebc43a7da
commit
0d6122b997
@ -156,6 +156,7 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="ShrinkwrapDialog.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
@ -171,6 +172,9 @@
|
||||
<ClCompile Include="Shrinkwrap90Manager.cpp">
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ShrinkwrapDialog.cpp">
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
|
||||
<ClCompile Include="pch.cpp">
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
|
||||
@ -21,11 +21,17 @@
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ShrinkwrapDialog.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ShrinkwrapDialog.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2,4 +2,5 @@ D:\App\C++\CreoPluging9.0\dllmain.cpp;D:\App\C++\CreoPluging9.0\CreoPluging9.0\x
|
||||
D:\App\C++\CreoPluging9.0\Creo90Manager.cpp;D:\App\C++\CreoPluging9.0\CreoPluging9.0\x64\Debug\Creo90Manager.obj
|
||||
D:\App\C++\CreoPluging9.0\ShrinkwrapCommand.cpp;D:\App\C++\CreoPluging9.0\CreoPluging9.0\x64\Debug\ShrinkwrapCommand.obj
|
||||
D:\App\C++\CreoPluging9.0\Shrinkwrap90Manager.cpp;D:\App\C++\CreoPluging9.0\CreoPluging9.0\x64\Debug\Shrinkwrap90Manager.obj
|
||||
D:\App\C++\CreoPluging9.0\ShrinkwrapDialog.cpp;D:\App\C++\CreoPluging9.0\CreoPluging9.0\x64\Debug\ShrinkwrapDialog.obj
|
||||
D:\App\C++\CreoPluging9.0\pch.cpp;D:\App\C++\CreoPluging9.0\CreoPluging9.0\x64\Debug\pch.obj
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
^D:\APP\C++\CREOPLUGING9.0\CREOPLUGING9.0\X64\DEBUG\CREO90MANAGER.OBJ|D:\APP\C++\CREOPLUGING9.0\CREOPLUGING9.0\X64\DEBUG\DLLMAIN.OBJ|D:\APP\C++\CREOPLUGING9.0\CREOPLUGING9.0\X64\DEBUG\PCH.OBJ|D:\APP\C++\CREOPLUGING9.0\CREOPLUGING9.0\X64\DEBUG\SHRINKWRAP90MANAGER.OBJ|D:\APP\C++\CREOPLUGING9.0\CREOPLUGING9.0\X64\DEBUG\SHRINKWRAPCOMMAND.OBJ
|
||||
^D:\APP\C++\CREOPLUGING9.0\CREOPLUGING9.0\X64\DEBUG\CREO90MANAGER.OBJ|D:\APP\C++\CREOPLUGING9.0\CREOPLUGING9.0\X64\DEBUG\DLLMAIN.OBJ|D:\APP\C++\CREOPLUGING9.0\CREOPLUGING9.0\X64\DEBUG\PCH.OBJ|D:\APP\C++\CREOPLUGING9.0\CREOPLUGING9.0\X64\DEBUG\SHRINKWRAP90MANAGER.OBJ|D:\APP\C++\CREOPLUGING9.0\CREOPLUGING9.0\X64\DEBUG\SHRINKWRAPCOMMAND.OBJ|D:\APP\C++\CREOPLUGING9.0\CREOPLUGING9.0\X64\DEBUG\SHRINKWRAPDIALOG.OBJ
|
||||
D:\App\C++\CreoPluging9.0\x64\Debug\CreoPluging9.0.lib
|
||||
D:\App\C++\CreoPluging9.0\x64\Debug\CreoPluging9.0.EXP
|
||||
D:\App\C++\CreoPluging9.0\x64\Debug\CreoPluging9.0.ILK
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
CreoPluging9.0/x64/Debug/ShrinkwrapDialog.obj
Normal file
BIN
CreoPluging9.0/x64/Debug/ShrinkwrapDialog.obj
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -9,6 +9,8 @@
|
||||
#include <filesystem>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
namespace {
|
||||
|
||||
@ -52,17 +54,47 @@ ShrinkwrapShellResult Shrinkwrap90Manager::ExportShell(const ShrinkwrapShellRequ
|
||||
|
||||
pfcPart_ptr outputPart = session->CreatePart(modelName.c_str());
|
||||
pfcModel_ptr outputModel = pfcModel::cast(outputPart);
|
||||
pfcShrinkwrapMergedSolidInstructions_ptr instr = pfcShrinkwrapMergedSolidInstructions::Create(outputModel);
|
||||
|
||||
pfcShrinkwrapModelExportInstructions_ptr modelInstr;
|
||||
|
||||
instr->SetQuality(req.quality);
|
||||
instr->SetAutoHoleFilling(req.fill_holes ? xtrue : xfalse);
|
||||
instr->SetIgnoreSmallSurfaces(req.ignore_small_surfaces ? xtrue : xfalse);
|
||||
instr->SetSmallSurfPercentage(req.small_surface_percentage);
|
||||
instr->SetIgnoreQuilts(req.ignore_quilts ? xtrue : xfalse);
|
||||
instr->SetIgnoreSkeleton(req.ignore_skeleton ? xtrue : xfalse);
|
||||
instr->SetAssignMassProperties(req.assign_mass_properties ? xtrue : xfalse);
|
||||
if (req.method == 1) {
|
||||
// Faceted Solid
|
||||
// Note: Faceted Solid export is handled via pfcShrinkwrapFacetedPartInstructions
|
||||
// But user wants "Faceted Solid" creation which usually creates a new model (like Merged Solid).
|
||||
// However, OTK distinguishes between "Export to file" (STL/VRML/FacetedPart) and "Create feature/model".
|
||||
// pfcShrinkwrapMergedSolidInstructions creates a new model.
|
||||
// pfcShrinkwrapSurfaceSubsetInstructions creates a new model.
|
||||
// pfcShrinkwrapFacetedPartInstructions exports to a file directly OR creates a model?
|
||||
// Let's check pfcShrinkwrapFacetedPartInstructions::Create signature.
|
||||
// Create(pfcModel_ptr OutputModel, xbool Lightweight)
|
||||
// So it exports to 'OutputModel'.
|
||||
|
||||
pfcShrinkwrapFacetedPartInstructions_ptr fInstr = pfcShrinkwrapFacetedPartInstructions::Create(outputModel, xfalse);
|
||||
modelInstr = pfcShrinkwrapModelExportInstructions::cast(fInstr);
|
||||
|
||||
pfcShrinkwrapExportInstructions_ptr exportInstr = pfcShrinkwrapExportInstructions::cast(instr);
|
||||
} else if (req.method == 2) {
|
||||
// Merged Solid
|
||||
pfcShrinkwrapMergedSolidInstructions_ptr mInstr = pfcShrinkwrapMergedSolidInstructions::Create(outputModel);
|
||||
modelInstr = pfcShrinkwrapModelExportInstructions::cast(mInstr);
|
||||
|
||||
} else {
|
||||
// Surface Subset (Default = 0)
|
||||
pfcShrinkwrapSurfaceSubsetInstructions_ptr sInstr = pfcShrinkwrapSurfaceSubsetInstructions::Create(outputModel);
|
||||
modelInstr = pfcShrinkwrapModelExportInstructions::cast(sInstr);
|
||||
}
|
||||
|
||||
// Common options
|
||||
modelInstr->SetQuality(req.quality);
|
||||
modelInstr->SetAutoHoleFilling(req.fill_holes ? xtrue : xfalse);
|
||||
modelInstr->SetIgnoreSmallSurfaces(req.ignore_small_surfaces ? xtrue : xfalse);
|
||||
if (req.ignore_small_surfaces) {
|
||||
modelInstr->SetSmallSurfPercentage(req.small_surface_percentage);
|
||||
}
|
||||
modelInstr->SetIgnoreQuilts(req.ignore_quilts ? xtrue : xfalse);
|
||||
modelInstr->SetIgnoreSkeleton(req.ignore_skeleton ? xtrue : xfalse);
|
||||
modelInstr->SetAssignMassProperties(req.assign_mass_properties ? xtrue : xfalse);
|
||||
|
||||
pfcShrinkwrapExportInstructions_ptr exportInstr = pfcShrinkwrapExportInstructions::cast(modelInstr);
|
||||
source->ExportShrinkwrap(exportInstr);
|
||||
|
||||
std::string dir = outPath.parent_path().string();
|
||||
@ -71,10 +103,21 @@ ShrinkwrapShellResult Shrinkwrap90Manager::ExportShell(const ShrinkwrapShellRequ
|
||||
outputPart->Backup(descr);
|
||||
|
||||
std::filesystem::path actualOutPath = outPath.parent_path() / (modelName + ".prt");
|
||||
|
||||
// Ensure file is written
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
|
||||
ShrinkwrapShellResult res;
|
||||
res.output_path = actualOutPath.string();
|
||||
std::error_code ec;
|
||||
uintmax_t bytes = std::filesystem::file_size(actualOutPath, ec);
|
||||
|
||||
if (ec || bytes == 0) {
|
||||
// Retry
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
bytes = std::filesystem::file_size(actualOutPath, ec);
|
||||
}
|
||||
|
||||
if (ec) bytes = 0;
|
||||
res.file_size = FormatFileSize(bytes);
|
||||
res.execution_time = ""; // 由上层填充
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#include "ShrinkwrapCommand.h"
|
||||
#include "Creo90Manager.h"
|
||||
#include "Shrinkwrap90Manager.h"
|
||||
#include "ShrinkwrapDialog.h"
|
||||
|
||||
#include "CreoOtk.h"
|
||||
|
||||
@ -66,18 +67,36 @@ void ShrinkwrapActionListener::OnCommand() {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string outPath = PromptForOutputPath(session);
|
||||
if (outPath.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ShrinkwrapShellRequest req;
|
||||
req.output_file_path = outPath;
|
||||
req.quality = 5;
|
||||
req.ignore_quilts = true;
|
||||
req.ignore_skeleton = true;
|
||||
req.assign_mass_properties = false;
|
||||
|
||||
// Show configuration dialog first
|
||||
if (!ShrinkwrapDialog::Show(req)) {
|
||||
return; // User cancelled
|
||||
}
|
||||
|
||||
std::ostringstream debugOss;
|
||||
const char* methodNames[] = { "Surface Subset", "Faceted Solid", "Merged Solid" };
|
||||
int mIdx = (req.method >= 0 && req.method <= 2) ? req.method : 0;
|
||||
|
||||
debugOss << "Parameters Applied:\n"
|
||||
<< "Method: " << methodNames[mIdx] << "\n"
|
||||
<< "Quality: " << req.quality << "\n"
|
||||
<< "Fill Holes: " << (req.fill_holes ? "Yes" : "No") << "\n"
|
||||
<< "Ignore Quilts: " << (req.ignore_quilts ? "Yes" : "No") << "\n"
|
||||
<< "Ignore Skeleton: " << (req.ignore_skeleton ? "Yes" : "No") << "\n"
|
||||
<< "Ignore Small: " << (req.ignore_small_surfaces ? "Yes" : "No");
|
||||
ShowMessage(session, debugOss.str());
|
||||
|
||||
std::string outPath = PromptForOutputPath(session);
|
||||
if (outPath.empty()) {
|
||||
return;
|
||||
}
|
||||
req.output_file_path = outPath;
|
||||
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
Shrinkwrap90Manager mgr;
|
||||
ShrinkwrapShellResult result = mgr.ExportShell(req);
|
||||
|
||||
232
ShrinkwrapDialog.cpp
Normal file
232
ShrinkwrapDialog.cpp
Normal file
@ -0,0 +1,232 @@
|
||||
#include "pch.h"
|
||||
#include "ShrinkwrapDialog.h"
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <uifcSlider.h>
|
||||
#include <uifcLabel.h>
|
||||
#include <uifcCheckButton.h>
|
||||
#include <uifcInputPanel.h>
|
||||
#include <uifcPushButton.h>
|
||||
#include <uifcDialog.h>
|
||||
#include <uifcDefaultListeners.h>
|
||||
#include <uifcExceptions.h>
|
||||
#include <uifcRadioGroup.h>
|
||||
|
||||
xstring ShrinkwrapDialog::DIALOG_NAME = "shrinkwrap_params";
|
||||
|
||||
class ShrinkwrapDialog::DialogListener : public uifcDefaultDialogListener {
|
||||
public:
|
||||
// This listener handles generic dialog events if needed.
|
||||
// For now we just implement it to satisfy the requirements if attached.
|
||||
};
|
||||
|
||||
class ShrinkwrapDialog::SliderListener : public uifcDefaultSliderListener {
|
||||
public:
|
||||
void OnChange(uifcSlider_ptr handle) override {
|
||||
OnDragMove(handle); // Re-use logic
|
||||
}
|
||||
|
||||
void OnDragMove(uifcSlider_ptr handle) override {
|
||||
try {
|
||||
int val = handle->GetIntegerValue(); // uifcSlider inherits GetIntegerValue
|
||||
uifcLabel_ptr lbl = uifcLabelFind(ShrinkwrapDialog::DIALOG_NAME, "quality_val_lbl");
|
||||
if (lbl) {
|
||||
std::stringstream ss;
|
||||
ss << val;
|
||||
lbl->SetText(ss.str().c_str());
|
||||
}
|
||||
} catch (...) {}
|
||||
}
|
||||
};
|
||||
|
||||
class ShrinkwrapDialog::CheckButtonListener : public uifcDefaultCheckButtonListener {
|
||||
public:
|
||||
void OnActivate(uifcCheckButton_ptr handle) override {
|
||||
try {
|
||||
uifcCheckState state = handle->GetCheckedState();
|
||||
bool checked = (state == uifcCHECK_STATE_SET);
|
||||
uifcInputPanel_ptr ip = uifcInputPanelFind(ShrinkwrapDialog::DIALOG_NAME, "small_surf_pct_ip");
|
||||
if (ip) {
|
||||
// uifcInputPanel inherits uifcComponent which has SetEnabled
|
||||
// Let's check uifcComponent methods or if it's SetEnabled vs SetEnable
|
||||
// uifcSlider.h shows SetEnabled(xbool). Let's assume InputPanel has it too via Component.
|
||||
// The error "SetEnable is not a member" suggests it's likely SetEnabled.
|
||||
ip->SetEnabled(checked);
|
||||
}
|
||||
} catch (...) {}
|
||||
}
|
||||
};
|
||||
|
||||
// ... ButtonListener removed as we use specific listeners below ...
|
||||
|
||||
class OKButtonListener : public uifcDefaultPushButtonListener {
|
||||
public:
|
||||
OKButtonListener(bool& res) : result(res) {}
|
||||
void OnActivate(uifcPushButton_ptr handle) override {
|
||||
result = true;
|
||||
uifcExitDialog(handle->GetDialog(), 0);
|
||||
}
|
||||
private:
|
||||
bool& result;
|
||||
};
|
||||
|
||||
class CancelButtonListener : public uifcDefaultPushButtonListener {
|
||||
public:
|
||||
void OnActivate(uifcPushButton_ptr handle) override {
|
||||
uifcExitDialog(handle->GetDialog(), 0);
|
||||
}
|
||||
};
|
||||
|
||||
class QualitySliderListener : public uifcDefaultSliderListener {
|
||||
public:
|
||||
void OnDragMove(uifcSlider_ptr handle) override {
|
||||
UpdateLabel(handle);
|
||||
}
|
||||
void OnChange(uifcSlider_ptr handle) override {
|
||||
UpdateLabel(handle);
|
||||
}
|
||||
|
||||
private:
|
||||
void UpdateLabel(uifcSlider_ptr handle) {
|
||||
try {
|
||||
int val = handle->GetIntegerValue(); // Use GetIntegerValue
|
||||
uifcLabel_ptr lbl = uifcLabelFind(handle->GetDialog(), "quality_val_lbl");
|
||||
if (lbl) {
|
||||
std::stringstream ss;
|
||||
ss << val;
|
||||
lbl->SetText(ss.str().c_str());
|
||||
}
|
||||
} catch (...) {}
|
||||
}
|
||||
};
|
||||
|
||||
class SmallSurfCheckListener : public uifcDefaultCheckButtonListener {
|
||||
public:
|
||||
void OnActivate(uifcCheckButton_ptr handle) override {
|
||||
try {
|
||||
uifcCheckState state = handle->GetCheckedState();
|
||||
bool checked = (state == uifcCHECK_STATE_SET);
|
||||
uifcInputPanel_ptr ip = uifcInputPanelFind(handle->GetDialog(), "small_surf_pct_ip");
|
||||
if (ip) ip->SetEnabled(checked); // Use SetEnabled
|
||||
} catch (...) {}
|
||||
}
|
||||
};
|
||||
|
||||
void ShrinkwrapDialog::InitValues(const ShrinkwrapShellRequest& request) {
|
||||
try {
|
||||
uifcRadioGroup_ptr methodRg = uifcRadioGroupFind(DIALOG_NAME, "method_rg");
|
||||
if (methodRg) {
|
||||
xstringsequence_ptr sel = xstringsequence::create();
|
||||
std::stringstream ss;
|
||||
ss << request.method;
|
||||
sel->append(ss.str().c_str());
|
||||
methodRg->SetSelectedItemNameArray(sel); // SetSelectedItemNameArray
|
||||
}
|
||||
|
||||
uifcCheckButtonFind(DIALOG_NAME, "fill_holes_cb")->SetCheckedState(request.fill_holes ? uifcCHECK_STATE_SET : uifcCHECK_STATE_UNSET);
|
||||
uifcCheckButtonFind(DIALOG_NAME, "ignore_quilts_cb")->SetCheckedState(request.ignore_quilts ? uifcCHECK_STATE_SET : uifcCHECK_STATE_UNSET);
|
||||
uifcCheckButtonFind(DIALOG_NAME, "ignore_skeleton_cb")->SetCheckedState(request.ignore_skeleton ? uifcCHECK_STATE_SET : uifcCHECK_STATE_UNSET);
|
||||
uifcCheckButtonFind(DIALOG_NAME, "assign_mass_cb")->SetCheckedState(request.assign_mass_properties ? uifcCHECK_STATE_SET : uifcCHECK_STATE_UNSET);
|
||||
|
||||
uifcCheckButton_ptr smallCb = uifcCheckButtonFind(DIALOG_NAME, "ignore_small_cb");
|
||||
smallCb->SetCheckedState(request.ignore_small_surfaces ? uifcCHECK_STATE_SET : uifcCHECK_STATE_UNSET);
|
||||
|
||||
uifcInputPanel_ptr smallIp = uifcInputPanelFind(DIALOG_NAME, "small_surf_pct_ip");
|
||||
smallIp->SetDoubleValue(request.small_surface_percentage);
|
||||
smallIp->SetEnabled(request.ignore_small_surfaces);
|
||||
|
||||
uifcSlider_ptr slider = uifcSliderFind(DIALOG_NAME, "quality_slider");
|
||||
slider->SetMinimumIntegerValue(1);
|
||||
slider->SetMaximumIntegerValue(10);
|
||||
slider->SetIntegerValue(request.quality); // SetIntegerValue
|
||||
|
||||
uifcLabel_ptr qLbl = uifcLabelFind(DIALOG_NAME, "quality_val_lbl");
|
||||
std::stringstream ss;
|
||||
ss << request.quality;
|
||||
qLbl->SetText(ss.str().c_str());
|
||||
|
||||
} catch (...) {}
|
||||
}
|
||||
|
||||
void ShrinkwrapDialog::UpdateRequest(ShrinkwrapShellRequest& request) {
|
||||
try {
|
||||
uifcRadioGroup_ptr methodRg = uifcRadioGroupFind(DIALOG_NAME, "method_rg");
|
||||
if (methodRg) {
|
||||
xstringsequence_ptr sel = methodRg->GetSelectedItemNameArray(); // GetSelectedItemNameArray
|
||||
if (sel && sel->getarraysize() > 0) {
|
||||
std::string s = (const char*)sel->get(0);
|
||||
try {
|
||||
request.method = std::stoi(s);
|
||||
} catch (...) {}
|
||||
}
|
||||
}
|
||||
|
||||
request.fill_holes = (uifcCheckButtonFind(DIALOG_NAME, "fill_holes_cb")->GetCheckedState() == uifcCHECK_STATE_SET);
|
||||
request.ignore_quilts = (uifcCheckButtonFind(DIALOG_NAME, "ignore_quilts_cb")->GetCheckedState() == uifcCHECK_STATE_SET);
|
||||
request.ignore_skeleton = (uifcCheckButtonFind(DIALOG_NAME, "ignore_skeleton_cb")->GetCheckedState() == uifcCHECK_STATE_SET);
|
||||
request.assign_mass_properties = (uifcCheckButtonFind(DIALOG_NAME, "assign_mass_cb")->GetCheckedState() == uifcCHECK_STATE_SET);
|
||||
|
||||
request.ignore_small_surfaces = (uifcCheckButtonFind(DIALOG_NAME, "ignore_small_cb")->GetCheckedState() == uifcCHECK_STATE_SET);
|
||||
if (request.ignore_small_surfaces) {
|
||||
request.small_surface_percentage = uifcInputPanelFind(DIALOG_NAME, "small_surf_pct_ip")->GetDoubleValue();
|
||||
}
|
||||
|
||||
request.quality = uifcSliderFind(DIALOG_NAME, "quality_slider")->GetIntegerValue();
|
||||
} catch (...) {}
|
||||
}
|
||||
|
||||
|
||||
bool ShrinkwrapDialog::Show(ShrinkwrapShellRequest& request) {
|
||||
bool isOk = false;
|
||||
|
||||
// Debug point 1: Confirm entry
|
||||
/*
|
||||
pfcSession_ptr session = pfcGetProESession();
|
||||
if (session) session->UIShowMessageDialog("Entering ShrinkwrapDialog::Show", NULL);
|
||||
*/
|
||||
|
||||
try {
|
||||
int status = uifcCreateDialog(DIALOG_NAME, DIALOG_NAME);
|
||||
if (status != 0) {
|
||||
// Debug point 2: Creation failed (if status implies failure, though uifc usually throws)
|
||||
}
|
||||
|
||||
InitValues(request);
|
||||
|
||||
uifcPushButtonFind(DIALOG_NAME, "ok_pb")->AddActionListener(new OKButtonListener(isOk));
|
||||
uifcPushButtonFind(DIALOG_NAME, "cancel_pb")->AddActionListener(new CancelButtonListener());
|
||||
uifcSliderFind(DIALOG_NAME, "quality_slider")->AddActionListener(new QualitySliderListener());
|
||||
uifcCheckButtonFind(DIALOG_NAME, "ignore_small_cb")->AddActionListener(new SmallSurfCheckListener());
|
||||
|
||||
uifcActivateDialog(DIALOG_NAME);
|
||||
|
||||
if (isOk) {
|
||||
UpdateRequest(request);
|
||||
}
|
||||
|
||||
uifcDestroyDialog(DIALOG_NAME);
|
||||
} catch (pfcXToolkitError& e) {
|
||||
// Log OTK errors or show a message
|
||||
pfcSession_ptr session = pfcGetProESession();
|
||||
if (session) {
|
||||
xstring msg = e.GetMessage();
|
||||
std::stringstream ss;
|
||||
ss << "OTK Error: " << msg;
|
||||
session->UIShowMessageDialog(ss.str().c_str(), NULL);
|
||||
}
|
||||
try {
|
||||
uifcDestroyDialog(DIALOG_NAME);
|
||||
} catch (...) {}
|
||||
return false;
|
||||
} catch (...) {
|
||||
pfcSession_ptr session = pfcGetProESession();
|
||||
if (session) {
|
||||
session->UIShowMessageDialog("Unknown exception in dialog creation", NULL);
|
||||
}
|
||||
try {
|
||||
uifcDestroyDialog(DIALOG_NAME);
|
||||
} catch (...) {}
|
||||
return false;
|
||||
}
|
||||
return isOk;
|
||||
}
|
||||
20
ShrinkwrapDialog.h
Normal file
20
ShrinkwrapDialog.h
Normal file
@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "ShrinkwrapTypes.h"
|
||||
#include "CreoOtk.h"
|
||||
#include <pfcGlobal.h>
|
||||
|
||||
class ShrinkwrapDialog {
|
||||
public:
|
||||
static xstring DIALOG_NAME;
|
||||
static bool Show(ShrinkwrapShellRequest& request);
|
||||
|
||||
private:
|
||||
class DialogListener;
|
||||
class SliderListener;
|
||||
class ButtonListener;
|
||||
class CheckButtonListener;
|
||||
|
||||
static void InitValues(const ShrinkwrapShellRequest& request);
|
||||
static void UpdateRequest(ShrinkwrapShellRequest& request);
|
||||
};
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
struct ShrinkwrapShellRequest {
|
||||
std::string software_type = "creo";
|
||||
int method = 0; // 0=Surface Subset, 1=Faceted Solid, 2=Merged Solid
|
||||
int quality = 5; // 1-10
|
||||
double chord_height = 0.1; // 当前版本不映射到 OTK Shrinkwrap
|
||||
bool fill_holes = false;
|
||||
|
||||
153
text/chinese_cn/resource/shrinkwrap_params.res
Normal file
153
text/chinese_cn/resource/shrinkwrap_params.res
Normal file
@ -0,0 +1,153 @@
|
||||
(Dialog shrinkwrap_params
|
||||
(Components
|
||||
(SubLayout method_lay)
|
||||
(SubLayout options_lay)
|
||||
(SubLayout quality_lay)
|
||||
(SubLayout control_lay)
|
||||
(Separator separator)
|
||||
)
|
||||
|
||||
(Resources
|
||||
(.Label "Light Export Parameters")
|
||||
(.Resizeable False)
|
||||
(.DefaultButton "ok_pb")
|
||||
(.Layout
|
||||
(Grid (Rows 1 1 0 1 0) (Cols 1)
|
||||
method_lay
|
||||
options_lay
|
||||
quality_lay
|
||||
separator
|
||||
control_lay
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(Layout method_lay
|
||||
(Components
|
||||
(RadioGroup method_rg)
|
||||
)
|
||||
|
||||
(Resources
|
||||
(method_rg.Names "0"
|
||||
"1"
|
||||
"2")
|
||||
(method_rg.Labels "Surface Subset"
|
||||
"Faceted Solid"
|
||||
"Merged Solid")
|
||||
(method_rg.Orientation 1) ! Vertical
|
||||
(.Label "Creation Method")
|
||||
(.Decorated True)
|
||||
(.AttachLeft True)
|
||||
(.AttachRight True)
|
||||
(.Layout
|
||||
(Grid (Rows 1) (Cols 1)
|
||||
method_rg
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(Layout options_lay
|
||||
(Components
|
||||
(CheckButton fill_holes_cb)
|
||||
(CheckButton ignore_quilts_cb)
|
||||
(CheckButton ignore_skeleton_cb)
|
||||
(CheckButton assign_mass_cb)
|
||||
(CheckButton ignore_small_cb)
|
||||
(InputPanel small_surf_pct_ip)
|
||||
(Label small_surf_pct_lbl)
|
||||
)
|
||||
|
||||
(Resources
|
||||
(fill_holes_cb.Label "Fill holes")
|
||||
(fill_holes_cb.AttachLeft True)
|
||||
(ignore_quilts_cb.Label "Ignore quilts")
|
||||
(ignore_quilts_cb.AttachLeft True)
|
||||
(ignore_skeleton_cb.Label "Ignore skeleton")
|
||||
(ignore_skeleton_cb.AttachLeft True)
|
||||
(assign_mass_cb.Label "Assign mass properties")
|
||||
(assign_mass_cb.AttachLeft True)
|
||||
(ignore_small_cb.Label "Ignore small surfaces")
|
||||
(ignore_small_cb.AttachLeft True)
|
||||
(small_surf_pct_lbl.Label "% of model size")
|
||||
(small_surf_pct_lbl.AttachLeft True)
|
||||
(small_surf_pct_ip.Columns 5)
|
||||
(small_surf_pct_ip.InputType 4) ! Real number
|
||||
(small_surf_pct_ip.MinVal 0.0)
|
||||
(small_surf_pct_ip.MaxVal 100.0)
|
||||
|
||||
(.Label "Options")
|
||||
(.Decorated True)
|
||||
(.AttachLeft True)
|
||||
(.AttachRight True)
|
||||
(.Layout
|
||||
(Grid (Rows 1 1 1 1 1) (Cols 1 1)
|
||||
fill_holes_cb
|
||||
ignore_quilts_cb
|
||||
ignore_skeleton_cb
|
||||
assign_mass_cb
|
||||
ignore_small_cb
|
||||
(Grid (Rows 1) (Cols 1 1)
|
||||
small_surf_pct_ip
|
||||
small_surf_pct_lbl
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(Layout quality_lay
|
||||
(Components
|
||||
(Label quality_lbl)
|
||||
(Slider quality_slider)
|
||||
(Label quality_val_lbl)
|
||||
)
|
||||
|
||||
(Resources
|
||||
(quality_lbl.Label "Quality Level:")
|
||||
(quality_lbl.AttachLeft True)
|
||||
(quality_slider.MinVal 1)
|
||||
(quality_slider.MaxVal 10)
|
||||
(quality_slider.Columns 15)
|
||||
(quality_val_lbl.Label "5")
|
||||
(quality_val_lbl.Columns 2)
|
||||
|
||||
(.Label "Output Quality")
|
||||
(.Decorated True)
|
||||
(.AttachLeft True)
|
||||
(.AttachRight True)
|
||||
(.Layout
|
||||
(Grid (Rows 1) (Cols 1 1 1)
|
||||
quality_lbl
|
||||
quality_slider
|
||||
quality_val_lbl
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(Layout control_lay
|
||||
(Components
|
||||
(PushButton ok_pb)
|
||||
(PushButton cancel_pb)
|
||||
)
|
||||
|
||||
(Resources
|
||||
(ok_pb.Label "OK")
|
||||
(ok_pb.Columns 6)
|
||||
(cancel_pb.Label "Cancel")
|
||||
(cancel_pb.Columns 6)
|
||||
|
||||
(.AttachRight True)
|
||||
(.TopOffset 5)
|
||||
(.BottomOffset 5)
|
||||
(.RightOffset 5)
|
||||
(.Layout
|
||||
(Grid (Rows 1) (Cols 1 1)
|
||||
ok_pb
|
||||
cancel_pb
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
12
text/chinese_cn/shrinkwrap_msg.txt
Normal file
12
text/chinese_cn/shrinkwrap_msg.txt
Normal file
@ -0,0 +1,12 @@
|
||||
LightExport
|
||||
LightExport
|
||||
#
|
||||
#
|
||||
LightExport Help
|
||||
LightExport Help
|
||||
#
|
||||
#
|
||||
LightExport Description
|
||||
LightExport Description
|
||||
#
|
||||
#
|
||||
153
text/usascii/resource/shrinkwrap_params.res
Normal file
153
text/usascii/resource/shrinkwrap_params.res
Normal file
@ -0,0 +1,153 @@
|
||||
(Dialog shrinkwrap_params
|
||||
(Components
|
||||
(SubLayout method_lay)
|
||||
(SubLayout options_lay)
|
||||
(SubLayout quality_lay)
|
||||
(SubLayout control_lay)
|
||||
(Separator separator)
|
||||
)
|
||||
|
||||
(Resources
|
||||
(.Label "Light Export Parameters")
|
||||
(.Resizeable False)
|
||||
(.DefaultButton "ok_pb")
|
||||
(.Layout
|
||||
(Grid (Rows 1 1 0 1 0) (Cols 1)
|
||||
method_lay
|
||||
options_lay
|
||||
quality_lay
|
||||
separator
|
||||
control_lay
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(Layout method_lay
|
||||
(Components
|
||||
(RadioGroup method_rg)
|
||||
)
|
||||
|
||||
(Resources
|
||||
(method_rg.Names "0"
|
||||
"1"
|
||||
"2")
|
||||
(method_rg.Labels "Surface Subset"
|
||||
"Faceted Solid"
|
||||
"Merged Solid")
|
||||
(method_rg.Orientation 1) ! Vertical
|
||||
(.Label "Creation Method")
|
||||
(.Decorated True)
|
||||
(.AttachLeft True)
|
||||
(.AttachRight True)
|
||||
(.Layout
|
||||
(Grid (Rows 1) (Cols 1)
|
||||
method_rg
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(Layout options_lay
|
||||
(Components
|
||||
(CheckButton fill_holes_cb)
|
||||
(CheckButton ignore_quilts_cb)
|
||||
(CheckButton ignore_skeleton_cb)
|
||||
(CheckButton assign_mass_cb)
|
||||
(CheckButton ignore_small_cb)
|
||||
(InputPanel small_surf_pct_ip)
|
||||
(Label small_surf_pct_lbl)
|
||||
)
|
||||
|
||||
(Resources
|
||||
(fill_holes_cb.Label "Fill holes")
|
||||
(fill_holes_cb.AttachLeft True)
|
||||
(ignore_quilts_cb.Label "Ignore quilts")
|
||||
(ignore_quilts_cb.AttachLeft True)
|
||||
(ignore_skeleton_cb.Label "Ignore skeleton")
|
||||
(ignore_skeleton_cb.AttachLeft True)
|
||||
(assign_mass_cb.Label "Assign mass properties")
|
||||
(assign_mass_cb.AttachLeft True)
|
||||
(ignore_small_cb.Label "Ignore small surfaces")
|
||||
(ignore_small_cb.AttachLeft True)
|
||||
(small_surf_pct_lbl.Label "% of model size")
|
||||
(small_surf_pct_lbl.AttachLeft True)
|
||||
(small_surf_pct_ip.Columns 5)
|
||||
(small_surf_pct_ip.InputType 4) ! Real number
|
||||
(small_surf_pct_ip.MinVal 0.0)
|
||||
(small_surf_pct_ip.MaxVal 100.0)
|
||||
|
||||
(.Label "Options")
|
||||
(.Decorated True)
|
||||
(.AttachLeft True)
|
||||
(.AttachRight True)
|
||||
(.Layout
|
||||
(Grid (Rows 1 1 1 1 1) (Cols 1 1)
|
||||
fill_holes_cb
|
||||
ignore_quilts_cb
|
||||
ignore_skeleton_cb
|
||||
assign_mass_cb
|
||||
ignore_small_cb
|
||||
(Grid (Rows 1) (Cols 1 1)
|
||||
small_surf_pct_ip
|
||||
small_surf_pct_lbl
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(Layout quality_lay
|
||||
(Components
|
||||
(Label quality_lbl)
|
||||
(Slider quality_slider)
|
||||
(Label quality_val_lbl)
|
||||
)
|
||||
|
||||
(Resources
|
||||
(quality_lbl.Label "Quality Level:")
|
||||
(quality_lbl.AttachLeft True)
|
||||
(quality_slider.MinVal 1)
|
||||
(quality_slider.MaxVal 10)
|
||||
(quality_slider.Columns 15)
|
||||
(quality_val_lbl.Label "5")
|
||||
(quality_val_lbl.Columns 2)
|
||||
|
||||
(.Label "Output Quality")
|
||||
(.Decorated True)
|
||||
(.AttachLeft True)
|
||||
(.AttachRight True)
|
||||
(.Layout
|
||||
(Grid (Rows 1) (Cols 1 1 1)
|
||||
quality_lbl
|
||||
quality_slider
|
||||
quality_val_lbl
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(Layout control_lay
|
||||
(Components
|
||||
(PushButton ok_pb)
|
||||
(PushButton cancel_pb)
|
||||
)
|
||||
|
||||
(Resources
|
||||
(ok_pb.Label "OK")
|
||||
(ok_pb.Columns 6)
|
||||
(cancel_pb.Label "Cancel")
|
||||
(cancel_pb.Columns 6)
|
||||
|
||||
(.AttachRight True)
|
||||
(.TopOffset 5)
|
||||
(.BottomOffset 5)
|
||||
(.RightOffset 5)
|
||||
(.Layout
|
||||
(Grid (Rows 1) (Cols 1 1)
|
||||
ok_pb
|
||||
cancel_pb
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user