Rename the old "Import / Assemble" feature to "Link / Assemble".
This better reflects what it does and avoids clashes with the new DXF import feature.
This commit is contained in:
parent
d05e9a938b
commit
febe0f5282
|
@ -613,7 +613,7 @@ int ShowContextMenu(void) {
|
||||||
int id_ = [sender tag];
|
int id_ = [sender tag];
|
||||||
if(id_ >= RECENT_OPEN && id_ < (RECENT_OPEN + MAX_RECENT))
|
if(id_ >= RECENT_OPEN && id_ < (RECENT_OPEN + MAX_RECENT))
|
||||||
SolveSpace::SolveSpaceUI::MenuFile(id_);
|
SolveSpace::SolveSpaceUI::MenuFile(id_);
|
||||||
else if(id_ >= RECENT_IMPORT && id_ < (RECENT_IMPORT + MAX_RECENT))
|
else if(id_ >= RECENT_LINK && id_ < (RECENT_LINK + MAX_RECENT))
|
||||||
SolveSpace::Group::MenuGroup(id_);
|
SolveSpace::Group::MenuGroup(id_);
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
@ -718,7 +718,7 @@ static void RefreshRecentMenu(int id_, int base) {
|
||||||
|
|
||||||
void RefreshRecentMenus(void) {
|
void RefreshRecentMenus(void) {
|
||||||
RefreshRecentMenu(GraphicsWindow::MNU_OPEN_RECENT, RECENT_OPEN);
|
RefreshRecentMenu(GraphicsWindow::MNU_OPEN_RECENT, RECENT_OPEN);
|
||||||
RefreshRecentMenu(GraphicsWindow::MNU_GROUP_RECENT, RECENT_IMPORT);
|
RefreshRecentMenu(GraphicsWindow::MNU_GROUP_RECENT, RECENT_LINK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToggleMenuBar(void) {
|
void ToggleMenuBar(void) {
|
||||||
|
@ -869,7 +869,7 @@ SolveSpace::DialogChoice SolveSpace::LocateImportedFileYesNoCancel(
|
||||||
const std::string &filename, bool canCancel) {
|
const std::string &filename, bool canCancel) {
|
||||||
NSAlert *alert = [[NSAlert alloc] init];
|
NSAlert *alert = [[NSAlert alloc] init];
|
||||||
[alert setMessageText:[NSString stringWithUTF8String:
|
[alert setMessageText:[NSString stringWithUTF8String:
|
||||||
("The imported file " + filename + " is not present.").c_str()]];
|
("The linked file " + filename + " is not present.").c_str()]];
|
||||||
[alert setInformativeText:
|
[alert setInformativeText:
|
||||||
@"Do you want to locate it manually?\n"
|
@"Do you want to locate it manually?\n"
|
||||||
"If you select \"No\", any geometry that depends on "
|
"If you select \"No\", any geometry that depends on "
|
||||||
|
|
|
@ -588,7 +588,7 @@ void GraphicsWindow::Paint(void) {
|
||||||
}
|
}
|
||||||
ssglDepthRangeOffset(0);
|
ssglDepthRangeOffset(0);
|
||||||
|
|
||||||
// Nasty case when we're reloading the imported files; could be that
|
// Nasty case when we're reloading the linked files; could be that
|
||||||
// we get an error, so a dialog pops up, and a message loop starts, and
|
// we get an error, so a dialog pops up, and a message loop starts, and
|
||||||
// we have to get called to paint ourselves. If the sketch is screwed
|
// we have to get called to paint ourselves. If the sketch is screwed
|
||||||
// up, then we could trigger an oops trying to draw.
|
// up, then we could trigger an oops trying to draw.
|
||||||
|
|
|
@ -263,7 +263,7 @@ void Entity::CalculateNumerical(bool forExport) {
|
||||||
actNormal = Quaternion::From(0, n.x, n.y, n.z);
|
actNormal = Quaternion::From(0, n.x, n.y, n.z);
|
||||||
}
|
}
|
||||||
if(forExport) {
|
if(forExport) {
|
||||||
// Visibility in copied import entities follows source file
|
// Visibility in copied linked entities follows source file
|
||||||
actVisible = IsVisible();
|
actVisible = IsVisible();
|
||||||
} else {
|
} else {
|
||||||
// Copied entities within a file are always visible
|
// Copied entities within a file are always visible
|
||||||
|
|
60
src/file.cpp
60
src/file.cpp
|
@ -116,8 +116,8 @@ const SolveSpaceUI::SaveTable SolveSpaceUI::SAVED[] = {
|
||||||
{ 'g', "Group.allDimsReference", 'b', &(SS.sv.g.allDimsReference) },
|
{ 'g', "Group.allDimsReference", 'b', &(SS.sv.g.allDimsReference) },
|
||||||
{ 'g', "Group.scale", 'f', &(SS.sv.g.scale) },
|
{ 'g', "Group.scale", 'f', &(SS.sv.g.scale) },
|
||||||
{ 'g', "Group.remap", 'M', &(SS.sv.g.remap) },
|
{ 'g', "Group.remap", 'M', &(SS.sv.g.remap) },
|
||||||
{ 'g', "Group.impFile", 'S', &(SS.sv.g.impFile) },
|
{ 'g', "Group.impFile", 'S', &(SS.sv.g.linkFile) },
|
||||||
{ 'g', "Group.impFileRel", 'S', &(SS.sv.g.impFileRel) },
|
{ 'g', "Group.impFileRel", 'S', &(SS.sv.g.linkFileRel) },
|
||||||
|
|
||||||
{ 'p', "Param.h.v.", 'x', &(SS.sv.p.h.v) },
|
{ 'p', "Param.h.v.", 'x', &(SS.sv.p.h.v) },
|
||||||
{ 'p', "Param.val", 'f', &(SS.sv.p.val) },
|
{ 'p', "Param.val", 'f', &(SS.sv.p.val) },
|
||||||
|
@ -256,8 +256,8 @@ void SolveSpaceUI::SaveUsingTable(int type) {
|
||||||
|
|
||||||
bool SolveSpaceUI::SaveToFile(const std::string &filename) {
|
bool SolveSpaceUI::SaveToFile(const std::string &filename) {
|
||||||
// Make sure all the entities are regenerated up to date, since they
|
// Make sure all the entities are regenerated up to date, since they
|
||||||
// will be exported. We reload the imported files because that rewrites
|
// will be exported. We reload the linked files because that rewrites
|
||||||
// the impFileRel for our possibly-new filename.
|
// the linkFileRel for our possibly-new filename.
|
||||||
SS.ScheduleShowTW();
|
SS.ScheduleShowTW();
|
||||||
SS.ReloadAllImported();
|
SS.ReloadAllImported();
|
||||||
SS.GenerateAll(SolveSpaceUI::GENERATE_ALL);
|
SS.GenerateAll(SolveSpaceUI::GENERATE_ALL);
|
||||||
|
@ -458,9 +458,9 @@ bool SolveSpaceUI::LoadFromFile(const std::string &filename) {
|
||||||
char *key = line, *val = e+1;
|
char *key = line, *val = e+1;
|
||||||
LoadUsingTable(key, val);
|
LoadUsingTable(key, val);
|
||||||
} else if(strcmp(line, "AddGroup")==0) {
|
} else if(strcmp(line, "AddGroup")==0) {
|
||||||
// legacy files have a spurious dependency between imported groups
|
// legacy files have a spurious dependency between linked groups
|
||||||
// and their parent groups, remove
|
// and their parent groups, remove
|
||||||
if(sv.g.type == Group::IMPORTED)
|
if(sv.g.type == Group::LINKED)
|
||||||
sv.g.opA.v = 0;
|
sv.g.opA.v = 0;
|
||||||
|
|
||||||
SK.group.Add(&(sv.g));
|
SK.group.Add(&(sv.g));
|
||||||
|
@ -653,7 +653,7 @@ bool SolveSpaceUI::LoadEntitiesFromFile(const std::string &filename, EntityList
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Handling of the relative-absolute path transformations for imports
|
// Handling of the relative-absolute path transformations for links
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
static std::vector<std::string> Split(const std::string &haystack, const std::string &needle)
|
static std::vector<std::string> Split(const std::string &haystack, const std::string &needle)
|
||||||
{
|
{
|
||||||
|
@ -781,79 +781,79 @@ static std::string PathSepUNIXToPlatform(const std::string &filename)
|
||||||
|
|
||||||
bool SolveSpaceUI::ReloadAllImported(bool canCancel)
|
bool SolveSpaceUI::ReloadAllImported(bool canCancel)
|
||||||
{
|
{
|
||||||
std::map<std::string, std::string> importMap;
|
std::map<std::string, std::string> linkMap;
|
||||||
allConsistent = false;
|
allConsistent = false;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < SK.group.n; i++) {
|
for(i = 0; i < SK.group.n; i++) {
|
||||||
Group *g = &(SK.group.elem[i]);
|
Group *g = &(SK.group.elem[i]);
|
||||||
if(g->type != Group::IMPORTED) continue;
|
if(g->type != Group::LINKED) continue;
|
||||||
|
|
||||||
if(isalpha(g->impFile[0]) && g->impFile[1] == ':') {
|
if(isalpha(g->linkFile[0]) && g->linkFile[1] == ':') {
|
||||||
// Make sure that g->impFileRel always contains a relative path
|
// Make sure that g->linkFileRel always contains a relative path
|
||||||
// in an UNIX format, even after we load an old file which had
|
// in an UNIX format, even after we load an old file which had
|
||||||
// the path in Windows format
|
// the path in Windows format
|
||||||
PathSepNormalize(g->impFileRel);
|
PathSepNormalize(g->linkFileRel);
|
||||||
}
|
}
|
||||||
|
|
||||||
g->impEntity.Clear();
|
g->impEntity.Clear();
|
||||||
g->impMesh.Clear();
|
g->impMesh.Clear();
|
||||||
g->impShell.Clear();
|
g->impShell.Clear();
|
||||||
|
|
||||||
if(importMap.count(g->impFile)) {
|
if(linkMap.count(g->linkFile)) {
|
||||||
std::string newPath = importMap[g->impFile];
|
std::string newPath = linkMap[g->linkFile];
|
||||||
if(!newPath.empty())
|
if(!newPath.empty())
|
||||||
g->impFile = newPath;
|
g->linkFile = newPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *test = ssfopen(g->impFile, "rb");
|
FILE *test = ssfopen(g->linkFile, "rb");
|
||||||
if(test) {
|
if(test) {
|
||||||
fclose(test); // okay, exists
|
fclose(test); // okay, exists
|
||||||
} else {
|
} else {
|
||||||
// It doesn't exist. Perhaps the entire tree has moved, and we
|
// It doesn't exist. Perhaps the entire tree has moved, and we
|
||||||
// can use the relative filename to get us back.
|
// can use the relative filename to get us back.
|
||||||
if(!SS.saveFile.empty()) {
|
if(!SS.saveFile.empty()) {
|
||||||
std::string rel = PathSepUNIXToPlatform(g->impFileRel);
|
std::string rel = PathSepUNIXToPlatform(g->linkFileRel);
|
||||||
std::string fromRel = MakePathAbsolute(SS.saveFile, rel);
|
std::string fromRel = MakePathAbsolute(SS.saveFile, rel);
|
||||||
test = ssfopen(fromRel, "rb");
|
test = ssfopen(fromRel, "rb");
|
||||||
if(test) {
|
if(test) {
|
||||||
fclose(test);
|
fclose(test);
|
||||||
// It worked, this is our new absolute path
|
// It worked, this is our new absolute path
|
||||||
g->impFile = fromRel;
|
g->linkFile = fromRel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try_load_file:
|
try_load_file:
|
||||||
if(LoadEntitiesFromFile(g->impFile, &(g->impEntity), &(g->impMesh), &(g->impShell)))
|
if(LoadEntitiesFromFile(g->linkFile, &(g->impEntity), &(g->impMesh), &(g->impShell)))
|
||||||
{
|
{
|
||||||
if(!SS.saveFile.empty()) {
|
if(!SS.saveFile.empty()) {
|
||||||
// Record the imported file's name relative to our filename;
|
// Record the linked file's name relative to our filename;
|
||||||
// if the entire tree moves, then everything will still work
|
// if the entire tree moves, then everything will still work
|
||||||
std::string rel = MakePathRelative(SS.saveFile, g->impFile);
|
std::string rel = MakePathRelative(SS.saveFile, g->linkFile);
|
||||||
g->impFileRel = PathSepPlatformToUNIX(rel);
|
g->linkFileRel = PathSepPlatformToUNIX(rel);
|
||||||
} else {
|
} else {
|
||||||
// We're not yet saved, so can't make it absolute.
|
// We're not yet saved, so can't make it absolute.
|
||||||
// This will only be used for display purposes, as SS.saveFile
|
// This will only be used for display purposes, as SS.saveFile
|
||||||
// is always nonempty when we are actually writing anything.
|
// is always nonempty when we are actually writing anything.
|
||||||
g->impFileRel = g->impFile;
|
g->linkFileRel = g->linkFile;
|
||||||
}
|
}
|
||||||
} else if(!importMap.count(g->impFile)) {
|
} else if(!linkMap.count(g->linkFile)) {
|
||||||
switch(LocateImportedFileYesNoCancel(g->impFileRel, canCancel)) {
|
switch(LocateImportedFileYesNoCancel(g->linkFileRel, canCancel)) {
|
||||||
case DIALOG_YES: {
|
case DIALOG_YES: {
|
||||||
std::string oldImpFile = g->impFile;
|
std::string oldImpFile = g->linkFile;
|
||||||
if(!GetOpenFile(&g->impFile, "", SlvsFileFilter)) {
|
if(!GetOpenFile(&g->linkFile, "", SlvsFileFilter)) {
|
||||||
if(canCancel)
|
if(canCancel)
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
importMap[oldImpFile] = g->impFile;
|
linkMap[oldImpFile] = g->linkFile;
|
||||||
goto try_load_file;
|
goto try_load_file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case DIALOG_NO:
|
case DIALOG_NO:
|
||||||
importMap[g->impFile] = "";
|
linkMap[g->linkFile] = "";
|
||||||
/* Geometry will be pruned by GenerateAll(). */
|
/* Geometry will be pruned by GenerateAll(). */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -862,7 +862,7 @@ try_load_file:
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// User was already asked to and refused to locate a missing
|
// User was already asked to and refused to locate a missing
|
||||||
// imported file.
|
// linked file.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,8 +100,8 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = {
|
||||||
{ 1, "E&xtrude", MNU_GROUP_EXTRUDE, S|'X', TN, mGrp },
|
{ 1, "E&xtrude", MNU_GROUP_EXTRUDE, S|'X', TN, mGrp },
|
||||||
{ 1, "&Lathe", MNU_GROUP_LATHE, S|'L', TN, mGrp },
|
{ 1, "&Lathe", MNU_GROUP_LATHE, S|'L', TN, mGrp },
|
||||||
{ 1, NULL, 0, 0, TN, NULL },
|
{ 1, NULL, 0, 0, TN, NULL },
|
||||||
{ 1, "Import / Assemble...", MNU_GROUP_IMPORT, S|'I', TN, mGrp },
|
{ 1, "Link / Assemble...", MNU_GROUP_LINK, S|'I', TN, mGrp },
|
||||||
{ 1, "Import Recent", MNU_GROUP_RECENT, 0, TN, mGrp },
|
{ 1, "Link Recent", MNU_GROUP_RECENT, 0, TN, mGrp },
|
||||||
|
|
||||||
{ 0, "&Sketch", 0, 0, TN, NULL },
|
{ 0, "&Sketch", 0, 0, TN, NULL },
|
||||||
{ 1, "In &Workplane", MNU_SEL_WORKPLANE, '2', TR, mReq },
|
{ 1, "In &Workplane", MNU_SEL_WORKPLANE, '2', TR, mReq },
|
||||||
|
@ -859,9 +859,9 @@ void GraphicsWindow::MenuEdit(int id) {
|
||||||
|
|
||||||
hGroup hg = e ? e->group : SS.GW.activeGroup;
|
hGroup hg = e ? e->group : SS.GW.activeGroup;
|
||||||
Group *g = SK.GetGroup(hg);
|
Group *g = SK.GetGroup(hg);
|
||||||
if(g->type != Group::IMPORTED) {
|
if(g->type != Group::LINKED) {
|
||||||
Error("To use this command, select a point or other "
|
Error("To use this command, select a point or other "
|
||||||
"entity from an imported part, or make an import "
|
"entity from an linked part, or make a link "
|
||||||
"group the active group.");
|
"group the active group.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,9 +77,9 @@ void Group::MenuGroup(int id) {
|
||||||
g.color = RGBi(100, 100, 100);
|
g.color = RGBi(100, 100, 100);
|
||||||
g.scale = 1;
|
g.scale = 1;
|
||||||
|
|
||||||
if(id >= RECENT_IMPORT && id < (RECENT_IMPORT + MAX_RECENT)) {
|
if(id >= RECENT_LINK && id < (RECENT_LINK + MAX_RECENT)) {
|
||||||
g.impFile = RecentFile[id-RECENT_IMPORT];
|
g.linkFile = RecentFile[id-RECENT_LINK];
|
||||||
id = GraphicsWindow::MNU_GROUP_IMPORT;
|
id = GraphicsWindow::MNU_GROUP_LINK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SS.GW.GroupSelection();
|
SS.GW.GroupSelection();
|
||||||
|
@ -205,15 +205,15 @@ void Group::MenuGroup(int id) {
|
||||||
g.name = "translate";
|
g.name = "translate";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GraphicsWindow::MNU_GROUP_IMPORT: {
|
case GraphicsWindow::MNU_GROUP_LINK: {
|
||||||
g.type = IMPORTED;
|
g.type = LINKED;
|
||||||
if(g.impFile.empty()) {
|
if(g.linkFile.empty()) {
|
||||||
if(!GetOpenFile(&g.impFile, "", SlvsFileFilter)) return;
|
if(!GetOpenFile(&g.linkFile, "", SlvsFileFilter)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assign the default name of the group based on the name of
|
// Assign the default name of the group based on the name of
|
||||||
// the imported file.
|
// the linked file.
|
||||||
std::string groupName = g.impFile;
|
std::string groupName = g.linkFile;
|
||||||
size_t pos;
|
size_t pos;
|
||||||
|
|
||||||
pos = groupName.rfind(PATH_SEP);
|
pos = groupName.rfind(PATH_SEP);
|
||||||
|
@ -234,7 +234,7 @@ void Group::MenuGroup(int id) {
|
||||||
if(groupName.length() > 0) {
|
if(groupName.length() > 0) {
|
||||||
g.name = groupName;
|
g.name = groupName;
|
||||||
} else {
|
} else {
|
||||||
g.name = "import";
|
g.name = "link";
|
||||||
}
|
}
|
||||||
|
|
||||||
g.meshCombine = COMBINE_AS_ASSEMBLE;
|
g.meshCombine = COMBINE_AS_ASSEMBLE;
|
||||||
|
@ -269,7 +269,7 @@ void Group::MenuGroup(int id) {
|
||||||
SK.group.AddAndAssignId(&g);
|
SK.group.AddAndAssignId(&g);
|
||||||
Group *gg = SK.GetGroup(g.h);
|
Group *gg = SK.GetGroup(g.h);
|
||||||
|
|
||||||
if(gg->type == IMPORTED) {
|
if(gg->type == LINKED) {
|
||||||
SS.ReloadAllImported();
|
SS.ReloadAllImported();
|
||||||
}
|
}
|
||||||
gg->clean = false;
|
gg->clean = false;
|
||||||
|
@ -287,7 +287,7 @@ void Group::MenuGroup(int id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Group::TransformImportedBy(Vector t, Quaternion q) {
|
void Group::TransformImportedBy(Vector t, Quaternion q) {
|
||||||
if(type != IMPORTED) oops();
|
if(type != LINKED) oops();
|
||||||
|
|
||||||
hParam tx, ty, tz, qw, qx, qy, qz;
|
hParam tx, ty, tz, qw, qx, qy, qz;
|
||||||
tx = h.param(0);
|
tx = h.param(0);
|
||||||
|
@ -323,7 +323,7 @@ std::string Group::DescriptionString(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Group::Activate(void) {
|
void Group::Activate(void) {
|
||||||
if(type == EXTRUDE || type == IMPORTED || type == LATHE || type == TRANSLATE || type == ROTATE) {
|
if(type == EXTRUDE || type == LINKED || type == LATHE || type == TRANSLATE || type == ROTATE) {
|
||||||
SS.GW.showFaces = true;
|
SS.GW.showFaces = true;
|
||||||
} else {
|
} else {
|
||||||
SS.GW.showFaces = false;
|
SS.GW.showFaces = false;
|
||||||
|
@ -529,7 +529,7 @@ void Group::Generate(IdList<Entity,hEntity> *entity,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IMPORTED:
|
case LINKED:
|
||||||
// The translation vector
|
// The translation vector
|
||||||
AddParam(param, h.param(0), gp.x);
|
AddParam(param, h.param(0), gp.x);
|
||||||
AddParam(param, h.param(1), gp.y);
|
AddParam(param, h.param(1), gp.y);
|
||||||
|
@ -566,7 +566,7 @@ void Group::AddEq(IdList<Equation,hEquation> *l, Expr *expr, int index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Group::GenerateEquations(IdList<Equation,hEquation> *l) {
|
void Group::GenerateEquations(IdList<Equation,hEquation> *l) {
|
||||||
if(type == IMPORTED) {
|
if(type == LINKED) {
|
||||||
// Normalize the quaternion
|
// Normalize the quaternion
|
||||||
ExprQuaternion q = {
|
ExprQuaternion q = {
|
||||||
Expr::From(h.param(3)),
|
Expr::From(h.param(3)),
|
||||||
|
@ -895,9 +895,9 @@ void Group::CopyEntity(IdList<Entity,hEntity> *el,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the entity came from an imported file where it was invisible then
|
// If the entity came from an linked file where it was invisible then
|
||||||
// ep->actiVisble will be false, and we should hide it. Or if the entity
|
// ep->actiVisble will be false, and we should hide it. Or if the entity
|
||||||
// came from a copy (e.g. step and repeat) of a force-hidden imported
|
// came from a copy (e.g. step and repeat) of a force-hidden linked
|
||||||
// entity, then we also want to hide it.
|
// entity, then we also want to hide it.
|
||||||
en.forceHidden = (!ep->actVisible) || ep->forceHidden;
|
en.forceHidden = (!ep->actVisible) || ep->forceHidden;
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ void Group::GenerateLoops(void) {
|
||||||
bezierOpens.Clear();
|
bezierOpens.Clear();
|
||||||
|
|
||||||
if(type == DRAWING_3D || type == DRAWING_WORKPLANE ||
|
if(type == DRAWING_3D || type == DRAWING_WORKPLANE ||
|
||||||
type == ROTATE || type == TRANSLATE || type == IMPORTED)
|
type == ROTATE || type == TRANSLATE || type == LINKED)
|
||||||
{
|
{
|
||||||
bool allClosed = false, allCoplanar = false, allNonZeroLen = false;
|
bool allClosed = false, allCoplanar = false, allNonZeroLen = false;
|
||||||
AssembleLoops(&allClosed, &allCoplanar, &allNonZeroLen);
|
AssembleLoops(&allClosed, &allCoplanar, &allNonZeroLen);
|
||||||
|
@ -285,7 +285,7 @@ void Group::GenerateShellAndMesh(void) {
|
||||||
for(sbls = sblss->l.First(); sbls; sbls = sblss->l.NextAfter(sbls)) {
|
for(sbls = sblss->l.First(); sbls; sbls = sblss->l.NextAfter(sbls)) {
|
||||||
thisShell.MakeFromRevolutionOf(sbls, pt, axis, color, this);
|
thisShell.MakeFromRevolutionOf(sbls, pt, axis, color, this);
|
||||||
}
|
}
|
||||||
} else if(type == IMPORTED) {
|
} else if(type == LINKED) {
|
||||||
// The imported shell or mesh are copied over, with the appropriate
|
// The imported shell or mesh are copied over, with the appropriate
|
||||||
// transformation applied. We also must remap the face entities.
|
// transformation applied. We also must remap the face entities.
|
||||||
Vector offset = {
|
Vector offset = {
|
||||||
|
|
|
@ -1019,7 +1019,7 @@ protected:
|
||||||
virtual void on_activate() {
|
virtual void on_activate() {
|
||||||
if(_id >= RECENT_OPEN && _id < (RECENT_OPEN + MAX_RECENT))
|
if(_id >= RECENT_OPEN && _id < (RECENT_OPEN + MAX_RECENT))
|
||||||
SolveSpaceUI::MenuFile(_id);
|
SolveSpaceUI::MenuFile(_id);
|
||||||
else if(_id >= RECENT_IMPORT && _id < (RECENT_IMPORT + MAX_RECENT))
|
else if(_id >= RECENT_LINK && _id < (RECENT_LINK + MAX_RECENT))
|
||||||
Group::MenuGroup(_id);
|
Group::MenuGroup(_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1053,7 +1053,7 @@ static void RefreshRecentMenu(int id, int base) {
|
||||||
|
|
||||||
void RefreshRecentMenus(void) {
|
void RefreshRecentMenus(void) {
|
||||||
RefreshRecentMenu(GraphicsWindow::MNU_OPEN_RECENT, RECENT_OPEN);
|
RefreshRecentMenu(GraphicsWindow::MNU_OPEN_RECENT, RECENT_OPEN);
|
||||||
RefreshRecentMenu(GraphicsWindow::MNU_GROUP_RECENT, RECENT_IMPORT);
|
RefreshRecentMenu(GraphicsWindow::MNU_GROUP_RECENT, RECENT_LINK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save/load */
|
/* Save/load */
|
||||||
|
@ -1223,7 +1223,7 @@ DialogChoice LoadAutosaveYesNo(void) {
|
||||||
DialogChoice LocateImportedFileYesNoCancel(const std::string &filename,
|
DialogChoice LocateImportedFileYesNoCancel(const std::string &filename,
|
||||||
bool canCancel) {
|
bool canCancel) {
|
||||||
Glib::ustring message =
|
Glib::ustring message =
|
||||||
"The imported file " + filename + " is not present.\n"
|
"The linked file " + filename + " is not present.\n"
|
||||||
"Do you want to locate it manually?\n"
|
"Do you want to locate it manually?\n"
|
||||||
"If you select \"No\", any geometry that depends on "
|
"If you select \"No\", any geometry that depends on "
|
||||||
"the missing file will be removed.";
|
"the missing file will be removed.";
|
||||||
|
|
|
@ -1421,15 +1421,15 @@ void GraphicsWindow::SpaceNavigatorMoved(double tx, double ty, double tz,
|
||||||
double aam = aa.Magnitude();
|
double aam = aa.Magnitude();
|
||||||
if(aam > 0.0) aa = aa.WithMagnitude(1);
|
if(aam > 0.0) aa = aa.WithMagnitude(1);
|
||||||
|
|
||||||
// This can either transform our view, or transform an imported part.
|
// This can either transform our view, or transform a linked part.
|
||||||
GroupSelection();
|
GroupSelection();
|
||||||
Entity *e = NULL;
|
Entity *e = NULL;
|
||||||
Group *g = NULL;
|
Group *g = NULL;
|
||||||
if(gs.points == 1 && gs.n == 1) e = SK.GetEntity(gs.point [0]);
|
if(gs.points == 1 && gs.n == 1) e = SK.GetEntity(gs.point [0]);
|
||||||
if(gs.entities == 1 && gs.n == 1) e = SK.GetEntity(gs.entity[0]);
|
if(gs.entities == 1 && gs.n == 1) e = SK.GetEntity(gs.entity[0]);
|
||||||
if(e) g = SK.GetGroup(e->group);
|
if(e) g = SK.GetGroup(e->group);
|
||||||
if(g && g->type == Group::IMPORTED && !shiftDown) {
|
if(g && g->type == Group::LINKED && !shiftDown) {
|
||||||
// Apply the transformation to an imported part. Gain down the Z
|
// Apply the transformation to a linked part. Gain down the Z
|
||||||
// axis, since it's hard to see what you're doing on that one since
|
// axis, since it's hard to see what you're doing on that one since
|
||||||
// it's normal to the screen.
|
// it's normal to the screen.
|
||||||
Vector t = projRight.ScaledBy(tx/scale).Plus(
|
Vector t = projRight.ScaledBy(tx/scale).Plus(
|
||||||
|
|
10
src/sketch.h
10
src/sketch.h
|
@ -99,7 +99,7 @@ public:
|
||||||
LATHE = 5101,
|
LATHE = 5101,
|
||||||
ROTATE = 5200,
|
ROTATE = 5200,
|
||||||
TRANSLATE = 5201,
|
TRANSLATE = 5201,
|
||||||
IMPORTED = 5300
|
LINKED = 5300
|
||||||
};
|
};
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
|
@ -191,8 +191,8 @@ public:
|
||||||
enum { REMAP_PRIME = 19477 };
|
enum { REMAP_PRIME = 19477 };
|
||||||
int remapCache[REMAP_PRIME];
|
int remapCache[REMAP_PRIME];
|
||||||
|
|
||||||
std::string impFile;
|
std::string linkFile;
|
||||||
std::string impFileRel;
|
std::string linkFileRel;
|
||||||
SMesh impMesh;
|
SMesh impMesh;
|
||||||
SShell impShell;
|
SShell impShell;
|
||||||
EntityList impEntity;
|
EntityList impEntity;
|
||||||
|
@ -464,12 +464,12 @@ public:
|
||||||
dogd(), beziers(), edges(), edgesChordTol(), screenBBox(),
|
dogd(), beziers(), edges(), edgesChordTol(), screenBBox(),
|
||||||
screenBBoxValid() {};
|
screenBBoxValid() {};
|
||||||
|
|
||||||
// An imported entity that was hidden in the source file ends up hidden
|
// A linked entity that was hidden in the source file ends up hidden
|
||||||
// here too.
|
// here too.
|
||||||
bool forceHidden;
|
bool forceHidden;
|
||||||
|
|
||||||
// All points/normals/distances have their numerical value; this is
|
// All points/normals/distances have their numerical value; this is
|
||||||
// a convenience, to simplify the import/assembly code, so that the
|
// a convenience, to simplify the link/assembly code, so that the
|
||||||
// part is entirely described by the entities.
|
// part is entirely described by the entities.
|
||||||
Vector actPoint;
|
Vector actPoint;
|
||||||
Quaternion actNormal;
|
Quaternion actNormal;
|
||||||
|
|
|
@ -376,7 +376,7 @@ bool SolveSpaceUI::GetFilenameAndSave(bool saveAs) {
|
||||||
if(saveAs || saveFile.empty()) {
|
if(saveAs || saveFile.empty()) {
|
||||||
if(!GetSaveFile(&saveFile, "", SlvsFileFilter)) return false;
|
if(!GetSaveFile(&saveFile, "", SlvsFileFilter)) return false;
|
||||||
// need to get new filename directly into saveFile, since that
|
// need to get new filename directly into saveFile, since that
|
||||||
// determines impFileRel path
|
// determines linkFileRel path
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SaveToFile(saveFile)) {
|
if(SaveToFile(saveFile)) {
|
||||||
|
|
|
@ -139,7 +139,7 @@ void ssremove(const std::string &filename);
|
||||||
|
|
||||||
#define MAX_RECENT 8
|
#define MAX_RECENT 8
|
||||||
#define RECENT_OPEN (0xf000)
|
#define RECENT_OPEN (0xf000)
|
||||||
#define RECENT_IMPORT (0xf100)
|
#define RECENT_LINK (0xf100)
|
||||||
extern std::string RecentFile[MAX_RECENT];
|
extern std::string RecentFile[MAX_RECENT];
|
||||||
void RefreshRecentMenus(void);
|
void RefreshRecentMenus(void);
|
||||||
|
|
||||||
|
@ -787,7 +787,7 @@ public:
|
||||||
void Exit(void);
|
void Exit(void);
|
||||||
|
|
||||||
// File load/save routines, including the additional files that get
|
// File load/save routines, including the additional files that get
|
||||||
// loaded when we have import groups.
|
// loaded when we have link groups.
|
||||||
FILE *fh;
|
FILE *fh;
|
||||||
void AfterNewFile(void);
|
void AfterNewFile(void);
|
||||||
static void RemoveFromRecentList(const std::string &filename);
|
static void RemoveFromRecentList(const std::string &filename);
|
||||||
|
|
|
@ -328,9 +328,9 @@ void TextWindow::ShowGroupInfo(void) {
|
||||||
times, times == 1 ? "" : "s",
|
times, times == 1 ? "" : "s",
|
||||||
g->h.v, &TextWindow::ScreenChangeExprA);
|
g->h.v, &TextWindow::ScreenChangeExprA);
|
||||||
}
|
}
|
||||||
} else if(g->type == Group::IMPORTED) {
|
} else if(g->type == Group::LINKED) {
|
||||||
Printf(true, " %Ftimport geometry from file%E");
|
Printf(true, " %Ftlink geometry from file%E");
|
||||||
Printf(false, "%Ba '%s'", g->impFileRel.c_str());
|
Printf(false, "%Ba '%s'", g->linkFileRel.c_str());
|
||||||
Printf(false, "%Bd %Ftscaled by%E %# %Fl%Ll%f%D[change]%E",
|
Printf(false, "%Bd %Ftscaled by%E %# %Fl%Ll%f%D[change]%E",
|
||||||
g->scale,
|
g->scale,
|
||||||
&TextWindow::ScreenChangeGroupScale, g->h.v);
|
&TextWindow::ScreenChangeGroupScale, g->h.v);
|
||||||
|
@ -345,12 +345,12 @@ void TextWindow::ShowGroupInfo(void) {
|
||||||
|
|
||||||
if(g->type == Group::EXTRUDE ||
|
if(g->type == Group::EXTRUDE ||
|
||||||
g->type == Group::LATHE ||
|
g->type == Group::LATHE ||
|
||||||
g->type == Group::IMPORTED)
|
g->type == Group::LINKED)
|
||||||
{
|
{
|
||||||
bool un = (g->meshCombine == Group::COMBINE_AS_UNION);
|
bool un = (g->meshCombine == Group::COMBINE_AS_UNION);
|
||||||
bool diff = (g->meshCombine == Group::COMBINE_AS_DIFFERENCE);
|
bool diff = (g->meshCombine == Group::COMBINE_AS_DIFFERENCE);
|
||||||
bool asy = (g->meshCombine == Group::COMBINE_AS_ASSEMBLE);
|
bool asy = (g->meshCombine == Group::COMBINE_AS_ASSEMBLE);
|
||||||
bool asa = (g->type == Group::IMPORTED);
|
bool asa = (g->type == Group::LINKED);
|
||||||
|
|
||||||
Printf(false, " %Ftsolid model as");
|
Printf(false, " %Ftsolid model as");
|
||||||
Printf(false, "%Ba %f%D%Lc%Fd%s union%E "
|
Printf(false, "%Ba %f%D%Lc%Fd%s union%E "
|
||||||
|
@ -378,7 +378,7 @@ void TextWindow::ShowGroupInfo(void) {
|
||||||
Printf(false, "%Bd %Ftopacity%E %@ %f%Lf%Fl[change]%E",
|
Printf(false, "%Bd %Ftopacity%E %@ %f%Lf%Fl[change]%E",
|
||||||
g->color.alphaF(),
|
g->color.alphaF(),
|
||||||
&TextWindow::ScreenOpacity);
|
&TextWindow::ScreenOpacity);
|
||||||
} else if(g->type == Group::IMPORTED) {
|
} else if(g->type == Group::LINKED) {
|
||||||
Printf(false, " %Fd%f%LP%s suppress this group's solid model",
|
Printf(false, " %Fd%f%LP%s suppress this group's solid model",
|
||||||
&TextWindow::ScreenChangeGroupOption,
|
&TextWindow::ScreenChangeGroupOption,
|
||||||
g->suppress ? CHECK_TRUE : CHECK_FALSE);
|
g->suppress ? CHECK_TRUE : CHECK_FALSE);
|
||||||
|
|
|
@ -46,7 +46,7 @@ static const struct {
|
||||||
{ Icon_step_translate, GraphicsWindow::MNU_GROUP_TRANS, "New group step and repeat translating" },
|
{ Icon_step_translate, GraphicsWindow::MNU_GROUP_TRANS, "New group step and repeat translating" },
|
||||||
{ Icon_sketch_in_plane, GraphicsWindow::MNU_GROUP_WRKPL, "New group in new workplane (thru given entities)" },
|
{ Icon_sketch_in_plane, GraphicsWindow::MNU_GROUP_WRKPL, "New group in new workplane (thru given entities)" },
|
||||||
{ Icon_sketch_in_3d, GraphicsWindow::MNU_GROUP_3D, "New group in 3d" },
|
{ Icon_sketch_in_3d, GraphicsWindow::MNU_GROUP_3D, "New group in 3d" },
|
||||||
{ Icon_assemble, GraphicsWindow::MNU_GROUP_IMPORT, "New group importing / assembling file" },
|
{ Icon_assemble, GraphicsWindow::MNU_GROUP_LINK, "New group linking / assembling file" },
|
||||||
{ SPACER, 0, 0 },
|
{ SPACER, 0, 0 },
|
||||||
|
|
||||||
{ Icon_in3d, GraphicsWindow::MNU_NEAREST_ISO, "Nearest isometric view" },
|
{ Icon_in3d, GraphicsWindow::MNU_NEAREST_ISO, "Nearest isometric view" },
|
||||||
|
|
2
src/ui.h
2
src/ui.h
|
@ -402,7 +402,7 @@ public:
|
||||||
MNU_GROUP_LATHE,
|
MNU_GROUP_LATHE,
|
||||||
MNU_GROUP_ROT,
|
MNU_GROUP_ROT,
|
||||||
MNU_GROUP_TRANS,
|
MNU_GROUP_TRANS,
|
||||||
MNU_GROUP_IMPORT,
|
MNU_GROUP_LINK,
|
||||||
MNU_GROUP_RECENT,
|
MNU_GROUP_RECENT,
|
||||||
// Constrain
|
// Constrain
|
||||||
MNU_DISTANCE_DIA,
|
MNU_DISTANCE_DIA,
|
||||||
|
|
|
@ -956,7 +956,7 @@ LRESULT CALLBACK GraphicsWndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||||
SolveSpaceUI::MenuFile(id);
|
SolveSpaceUI::MenuFile(id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if((id >= RECENT_IMPORT && id < (RECENT_IMPORT + MAX_RECENT))) {
|
if((id >= RECENT_LINK && id < (RECENT_LINK + MAX_RECENT))) {
|
||||||
Group::MenuGroup(id);
|
Group::MenuGroup(id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1116,7 +1116,7 @@ DialogChoice SolveSpace::LocateImportedFileYesNoCancel(const std::string &filena
|
||||||
EnableWindow(TextWnd, false);
|
EnableWindow(TextWnd, false);
|
||||||
|
|
||||||
std::string message =
|
std::string message =
|
||||||
"The imported file " + filename + " is not present.\n\n"
|
"The linked file " + filename + " is not present.\n\n"
|
||||||
"Do you want to locate it manually?\n\n"
|
"Do you want to locate it manually?\n\n"
|
||||||
"If you select \"No\", any geometry that depends on "
|
"If you select \"No\", any geometry that depends on "
|
||||||
"the missing file will be removed.";
|
"the missing file will be removed.";
|
||||||
|
@ -1209,7 +1209,7 @@ static void DoRecent(HMENU m, int base)
|
||||||
void SolveSpace::RefreshRecentMenus(void)
|
void SolveSpace::RefreshRecentMenus(void)
|
||||||
{
|
{
|
||||||
DoRecent(RecentOpenMenu, RECENT_OPEN);
|
DoRecent(RecentOpenMenu, RECENT_OPEN);
|
||||||
DoRecent(RecentImportMenu, RECENT_IMPORT);
|
DoRecent(RecentImportMenu, RECENT_LINK);
|
||||||
}
|
}
|
||||||
|
|
||||||
HMENU CreateGraphicsWindowMenus(void)
|
HMENU CreateGraphicsWindowMenus(void)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user