|
|
|
@ -1068,22 +1068,23 @@ export function RemoveTemplate(temp: TemplateRecord)
|
|
|
|
|
|
|
|
|
|
let replaceJig = new Jig();
|
|
|
|
|
|
|
|
|
|
/**新模块替换旧模块 */
|
|
|
|
|
export async function ReplaceTemplate(oldTemp: TemplateRecord, newTemp: TemplateRecord, reSelectSpace = true)
|
|
|
|
|
/**新模块替换旧模块 ,extendExpr-是否继承旧模板表达式*/
|
|
|
|
|
export async function ReplaceTemplate(oldTemp: TemplateRecord, newTemp: TemplateRecord, reSelectSpace = true, extendExpr = true)
|
|
|
|
|
{
|
|
|
|
|
//拷贝所有共有参数
|
|
|
|
|
for (let index = 0; index < oldTemp.Params.length; index++)
|
|
|
|
|
{
|
|
|
|
|
let oldParam = oldTemp.Params[index];
|
|
|
|
|
//https://gitee.com/BearCAD/WebCAD/pulls/1048#note_2620830
|
|
|
|
|
let newExpr = oldParam.expr;
|
|
|
|
|
if (index < 9)
|
|
|
|
|
if (extendExpr) //#I1MFG0,替换虚拟空间时不继承表达式
|
|
|
|
|
for (let index = 0; index < oldTemp.Params.length; index++)
|
|
|
|
|
{
|
|
|
|
|
newTemp.Params[index].expr = newExpr;
|
|
|
|
|
continue;
|
|
|
|
|
let oldParam = oldTemp.Params[index];
|
|
|
|
|
//https://gitee.com/BearCAD/WebCAD/pulls/1048#note_2620830
|
|
|
|
|
let newExpr = oldParam.expr;
|
|
|
|
|
if (index < 9)
|
|
|
|
|
{
|
|
|
|
|
newTemp.Params[index].expr = newExpr;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
newTemp.SetParamExpr(oldParam.name, newExpr);
|
|
|
|
|
}
|
|
|
|
|
newTemp.SetParamExpr(oldParam.name, newExpr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let positioning = oldTemp.Positioning;
|
|
|
|
|
// if (!(positioning instanceof PositioningTemporary && oldTemp.Parent && !oldTemp.Parent.IsErase))
|
|
|
|
@ -1196,7 +1197,7 @@ export async function SetTemplatePositionAndSetParent(spaceParse: ISpaceParse, t
|
|
|
|
|
else if (spaceParse.VisualSpaceBox)
|
|
|
|
|
{
|
|
|
|
|
let vstemplate = spaceParse.VisualSpaceBox.Template.Object as TemplateVisualSpace;
|
|
|
|
|
ReplaceTemplate(vstemplate, template);
|
|
|
|
|
ReplaceTemplate(vstemplate, template, true, false);
|
|
|
|
|
DeleteTempate(vstemplate);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|