多项功能优化

This commit is contained in:
GG Z
2024-12-22 10:26:12 +08:00
parent 77655c9ef5
commit 83b846f15f
66 changed files with 5424 additions and 2927 deletions

View File

@@ -17,37 +17,19 @@ public class MoveConnectCmd : ExternalCommand
Reference moveReference;
try
{
FuncFilter filter =
new(
e =>
((e is MEPCurve mep and not InsulationLiningBase) && mep.GetConnectors(true).Size > 0)
|| (
e is FamilyInstance instance
&& instance.MEPModel.ConnectorManager != null
&& instance.MEPModel.ConnectorManager.UnusedConnectors.Size > 0
)
);
baseReference = UiDocument.Selection.PickObject(
Autodesk.Revit.UI.Selection.ObjectType.Element,
filter,
new FuncFilter(e => e.GetConnectors(true)?.Size > 0),
"请选择基准的管线、管件、设备实例"
);
FuncFilter filter1 =
new(
e =>
e.Id != baseReference.ElementId
&& ((e is MEPCurve mep and not InsulationLiningBase) && mep.GetConnectors(true).Size > 0)
|| (
e is FamilyInstance instance
&& instance.MEPModel.ConnectorManager != null
&& instance.MEPModel.ConnectorManager.UnusedConnectors.Size > 0
&& instance.Id != baseReference.ElementId
)
);
moveReference = UiDocument.Selection.PickObject(
Autodesk.Revit.UI.Selection.ObjectType.Element,
filter,
new FuncFilter(
e =>
e.Id != baseReference.ElementId
&& e.GetConnectors(true)?.Size > 0
),
"请选择需要移动连接的管线、管件、设备实例"
);
}
@@ -120,7 +102,7 @@ public class MoveConnectCmd : ExternalCommand
else
{
//避免交点在原管线外,导致反向连接
if ((mainMEPCurve.GetLocCurve() as Line).IsInsideEx(intersectPoint, 0.5))
if ((mainMEPCurve.GetCurve() as Line).IsInsideEx(intersectPoint, 0.5))
{
ElementTransformUtils.MoveElement(Document, elementToMove!.Id, intersectPoint - origin2);
}