mirror of https://gitee.com/cf-fz/WebCAD.git
!170 捕捉功能重构与实现
parent
cf0557d353
commit
aa13bb1929
@ -0,0 +1,31 @@
|
||||
import { Command } from "../Editor/CommandMachine";
|
||||
import { app } from "../ApplicationServices/Application";
|
||||
import { Circle } from "../DatabaseServices/Circle";
|
||||
import { Arc } from "../DatabaseServices/Arc";
|
||||
import { CircleInternalTangentLines, CircleOuterTangentLines } from "../Common/CurveUtils";
|
||||
|
||||
export class DrawTangentLine implements Command
|
||||
{
|
||||
async exec()
|
||||
{
|
||||
let ss = await app.m_Editor.GetSelection({
|
||||
Msg: "请选择圆或者圆弧:",
|
||||
Filter: {
|
||||
filterTypes: [Circle, Arc]
|
||||
}
|
||||
});
|
||||
|
||||
let cirs = ss.SelectSet.SelectEntityList as Circle[];
|
||||
|
||||
for (let i = 0; i < cirs.length; i++)
|
||||
{
|
||||
for (let j = i + 1; j < cirs.length; j++)
|
||||
{
|
||||
let ls = CircleInternalTangentLines(cirs[i], cirs[j]).concat(CircleOuterTangentLines(cirs[i], cirs[j]));
|
||||
|
||||
for (let l of ls)
|
||||
app.m_Database.ModelSpace.Append(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
import { Entity } from "../DatabaseServices/Entity";
|
||||
import { Jig } from "./Jig";
|
||||
|
||||
let jig = new Jig();
|
||||
|
||||
/**
|
||||
* 动态拽拖的静态类,控制动态拽拖的状态.
|
||||
*
|
||||
* # Example:
|
||||
* //1.开始拽拖:->
|
||||
* //得到临时对象,如果en是已经存在的对象,那么将会被临时修改材质
|
||||
* let jigEnt = Jig.Draw(en);
|
||||
* //2.拽拖中:-> ....拽拖代码.更新jigEnt,你可以临时调用Jig.Destroy();
|
||||
* //3.结束拽拖:
|
||||
* Jig.End();
|
||||
* @export
|
||||
* @class Jig
|
||||
*/
|
||||
export class JigUtils
|
||||
{
|
||||
static End()
|
||||
{
|
||||
jig.End();
|
||||
}
|
||||
|
||||
/**
|
||||
* 还原源对象的材质
|
||||
*
|
||||
* @static
|
||||
* @memberof Jig
|
||||
*/
|
||||
static RestoreOriginEntity()
|
||||
{
|
||||
jig.RestoreOriginEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将在视图中绘制该对象.
|
||||
* 如果该对象已经存在图纸:那么将被拷贝,并且暂时暗显示,并且缓存原始数据,以便还原.
|
||||
* @static
|
||||
* @param {Entity} enOrg 源实体
|
||||
* @memberof Jig
|
||||
*/
|
||||
static Draw<T extends Entity>(enOrg: T): T
|
||||
{
|
||||
return jig.Draw(enOrg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 还原拽拖的实体到初始化状态.
|
||||
* @static
|
||||
* @memberof Jig
|
||||
*/
|
||||
static Restore()
|
||||
{
|
||||
jig.Restore();
|
||||
}
|
||||
|
||||
/**
|
||||
* 销毁临时对象,如果临时对象被加入到图纸,那么将不会被销毁.
|
||||
* @static
|
||||
* @memberof Jig
|
||||
*/
|
||||
static Destroy()
|
||||
{
|
||||
jig.Destroy();
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
|
||||
/**
|
||||
* OSMODE
|
||||
*/
|
||||
export enum ObjectSnapMode
|
||||
{
|
||||
None = 0, //无
|
||||
End = 1, //端点
|
||||
Mid = 2, //中点
|
||||
Cen = 4, //圆心
|
||||
Node = 8,//节点
|
||||
Qua = 16,//象限点
|
||||
Int = 32,//交点
|
||||
Ins = 64,//插入点
|
||||
Per = 128,//垂足
|
||||
Tan = 256,//切点
|
||||
Nea = 512,//最近点
|
||||
NotEntitySnap = 1024,//清除所有对象捕捉
|
||||
App = 2048,//外观交点
|
||||
Ext = 4096,//延伸
|
||||
Par = 8192,//平行
|
||||
Axis = 16384,//极轴
|
||||
All = ~(~0 << 15) - 1024,
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue