实现持续画点(esc结束); 优化div命令在闭合曲线/多段线上的效果

pull/86/head
janetX97 6 years ago
parent c22bb8a97b
commit 55886f7653

@ -58,6 +58,11 @@ export class CMD_Divide implements Command
let cu = enRes.Entity; let cu = enRes.Entity;
let len = cu.Length; let len = cu.Length;
let divLen = len / numRes.Value; let divLen = len / numRes.Value;
console.log(cu.IsClose);
if (cu.IsClose) //闭合曲线分割点+1
{
divCount += 1;
}
for (let i = 0; i < divCount - 1; i++) for (let i = 0; i < divCount - 1; i++)
{ {
let pt = cu.GetPointAtDistance(divLen * (i + 1)); let pt = cu.GetPointAtDistance(divLen * (i + 1));

@ -7,11 +7,19 @@ import { PromptStatus, PromptEntityResult } from '../Editor/PromptResult';
export class CMD_DrawPoint implements Command export class CMD_DrawPoint implements Command
{ {
async exec() async exec()
{
while (true)
{ {
let ptRes = await app.m_Editor.GetPoint({ Msg: "请输入或点取点的位置" }); let ptRes = await app.m_Editor.GetPoint({ Msg: "请输入或点取点的位置" });
if (ptRes.Status != PromptStatus.OK) if (ptRes.Status != PromptStatus.OK)
return; break;
else
{
let ptEnt = new Point(ptRes.Value); let ptEnt = new Point(ptRes.Value);
app.m_Database.ModelSpace.Append(ptEnt); app.m_Database.ModelSpace.Append(ptEnt);
continue;
}
} }
}
} }

@ -368,9 +368,9 @@ export class Polyline extends Curve
let cu = cus[i]; let cu = cus[i];
let len = cu.Length; let len = cu.Length;
if (dist <= len) if (dist <= len)
{
return i + cu.GetParamAtDist(dist); return i + cu.GetParamAtDist(dist);
} else if (equaln(dist, len, 1e-8))
return i + 1;
dist -= len; dist -= len;
} }
if (!this.m_ClosedMark) if (!this.m_ClosedMark)

@ -45,6 +45,8 @@ export class GetEntityServices implements EditorService
prompt = prompt || {}; prompt = prompt || {};
this.m_Editor.m_InputState &= InputState.Entsel; this.m_Editor.m_InputState &= InputState.Entsel;
this.m_Editor.m_SelectCtrl.Cancel();
//光标变换 //光标变换
this.m_Viewer.m_PreViewer.ToEntsel(); this.m_Viewer.m_PreViewer.ToEntsel();
this.m_Viewer.m_PreViewer.UpdateScreen(); this.m_Viewer.m_PreViewer.UpdateScreen();

Loading…
Cancel
Save