添加项目文件。

This commit is contained in:
GG Z
2026-02-23 14:58:05 +08:00
parent ce96926220
commit 771d780d6c
342 changed files with 33470 additions and 0 deletions

View File

@@ -0,0 +1,414 @@
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using HYJig;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
using Color = System.Drawing.Color;
using Form = System.Windows.Forms.Form;
using Point = System.Drawing.Point;
namespace HongYe.HVAC
{
public class PELineJig : XUiJigBase, IDisposable
{
public PELineJig(UIDocument uiDoc)
: base(uiDoc)
{
this.JigStage = PELineJig.EStage.eNoOper;
this.ResetPoint = XUiJigBase.EResetPoint.eNoOper;
this.DragLineColor = Color.FromArgb(175, 222, 239);
this.PointAlignType = PELineJig.AlignType.eMiddle;
this.MutilLineDist = new List<double>();
this.DrawEndLine = false;
this.DrawSize = false;
int height = Screen.PrimaryScreen.Bounds.Height;
PELineJig.SizeOffset = (int)(0.006 * (double)height);
PELineJig.BorderLength = (int)(0.04 * (double)height);
PELineJig.SizeFont = new Font("Arial", 2.5f * (float)PELineJig.SizeOffset, GraphicsUnit.Pixel);
PELineJig.TextFormat = new StringFormat(StringFormatFlags.NoClip);
PELineJig.TextFormat.Alignment = StringAlignment.Center;
PELineJig.TextFormat.LineAlignment = StringAlignment.Center;
PELineJig.SizeLineColor = Color.FromArgb(126, 163, 255);
PELineJig.SizeTextBrush = new SolidBrush(base.JigPen.Color);
this.OnMouseLeaveFormClientEvent += (this.OnMouseLeaveFormClientEvent);
this.OnMouseMoveIntoFormClientEvent += (this.OnMouseMoveIntoFormClientEvent);
}
public PELineJig(UIDocument uiDoc, Form userForm)
: base(uiDoc)
{
this.JigStage = PELineJig.EStage.eNoOper;
this.ResetPoint = XUiJigBase.EResetPoint.eNoOper;
this.DragLineColor = Color.FromArgb(175, 222, 239);
this.PointAlignType = PELineJig.AlignType.eMiddle;
this.MutilLineDist = new List<double>();
this.DrawEndLine = false;
this.DrawSize = false;
int height = Screen.PrimaryScreen.Bounds.Height;
PELineJig.SizeOffset = (int)(0.006 * (double)height);
PELineJig.BorderLength = (int)(0.04 * (double)height);
PELineJig.SizeFont = new Font("Arial", 2.5f * (float)PELineJig.SizeOffset, GraphicsUnit.Pixel);
PELineJig.TextFormat = new StringFormat(StringFormatFlags.NoClip);
PELineJig.TextFormat.Alignment = StringAlignment.Center;
PELineJig.TextFormat.LineAlignment = StringAlignment.Center;
PELineJig.SizeLineColor = Color.FromArgb(126, 163, 255);
PELineJig.SizeTextBrush = new SolidBrush(base.JigPen.Color);
this.OnMouseLeaveFormClientEvent +=(this.OnMouseLeaveFormClientEvent);
this.OnMouseMoveIntoFormClientEvent += (this.OnMouseMoveIntoFormClientEvent);
this.m_UserForm = userForm;
}
public new void Dispose()
{
base.Dispose();
PELineJig.SizeFont.Dispose();
PELineJig.TextFormat.Dispose();
PELineJig.SizeTextBrush.Dispose();
this.OnMouseLeaveFormClientEvent -=(this.OnMouseLeaveFormClientEvent);
this.OnMouseMoveIntoFormClientEvent -= (this.OnMouseMoveIntoFormClientEvent);
}
public XYZ PickStartPoint(string strPrompt = "请确定直线起点:")
{
try
{
this.JigStage = PELineJig.EStage.eStartPt;
this.StartPoint = base.UiDoc.Selection.PickPoint(strPrompt);
}
catch
{
this.StartPoint = null;
}
this.JigStage = PELineJig.EStage.eNoOper;
return this.StartPoint;
}
public XYZ PickEndPoint(XYZ ptStart, string strPrompt = "请确定直线终点:")
{
try
{
this.JigStage = PELineJig.EStage.eEndPt;
this.StartPoint = ptStart;
this.EndPoint = base.UiDoc.Selection.PickPoint(strPrompt);
this.EndPoint = this.GetResetPoint(this.StartPoint, this.EndPoint);
}
catch
{
if (this.m_prompDlg != null && base.CmdEndType == XUiJigBase.ECmdEndType.eEnter)
{
base.CmdEndType = XUiJigBase.ECmdEndType.eOther;
XYZ xyz = base.Client2Revit(this.m_ptCur);
xyz = Line.CreateUnbound(xyz, base.UiDoc.ActiveView.ViewDirection).Project(this.StartPoint).XYZPoint;
xyz = this.GetResetPoint(this.StartPoint, xyz);
double num = Convert.ToDouble(this.m_prompDlg.GetInputValue()) / 304.8;
XYZ xyz2 = (xyz - this.StartPoint).Normalize();
this.EndPoint = this.StartPoint + xyz2 * num;
}
else
{
this.EndPoint = null;
}
}
this.JigStage = PELineJig.EStage.eNoOper;
return this.EndPoint;
}
public XYZ GetResetPoint(XYZ ptBase, XYZ ptUser)
{
XYZ xyz = ptUser;
if (this.ResetPoint == XUiJigBase.EResetPoint.eByAngle)
{
xyz = JigFuncs.GetProjectPoint(base.UiDoc, ptUser, ptBase, this.LineAngle);
}
else if (this.ResetPoint == XUiJigBase.EResetPoint.eByOrtho)
{
xyz = JigFuncs.GetOrthoPoint(base.UiDoc, ptUser, ptBase);
}
else if (this.ResetPoint == XUiJigBase.EResetPoint.eByAxis)
{
XYZ axisPoint = JigFuncs.GetAxisPoint(base.UiDoc, ptUser, ptBase);
if (axisPoint != null)
{
xyz = axisPoint;
}
}
return xyz;
}
public override void Draw(PaintEventArgs paintEventArgs)
{
base.Draw(paintEventArgs);
if (!this.m_ptCur.IsEmpty)
{
if (this.JigStage == PELineJig.EStage.eEndPt)
{
XYZ xyz = base.Client2Revit(this.m_ptCur);
if (this.ResetPoint == XUiJigBase.EResetPoint.eByAngle)
{
xyz = JigFuncs.GetProjectPoint(base.UiDoc, xyz, this.StartPoint, this.LineAngle);
this.m_ptCur = base.Revit2Client(xyz);
}
else if (this.ResetPoint == XUiJigBase.EResetPoint.eByOrtho)
{
xyz = JigFuncs.GetOrthoPoint(base.UiDoc, xyz, this.StartPoint);
this.m_ptCur = base.Revit2Client(xyz);
}
else if (this.ResetPoint == XUiJigBase.EResetPoint.eByAxis)
{
XYZ axisPoint = JigFuncs.GetAxisPoint(base.UiDoc, xyz, this.StartPoint);
if (axisPoint != null)
{
xyz = axisPoint;
this.m_ptCur = base.Revit2Client(xyz);
base.DrawAxisLine(paintEventArgs.Graphics, this.StartPoint, xyz);
}
}
XGraphics xgraphics = new XGraphics(paintEventArgs.Graphics, base.JigPen);
Color color = xgraphics.m_pen.Color;
xgraphics.m_pen.Color = this.DragLineColor;
if (this.MutilLineDist.Count < 1)
{
new XLine2D(base.Revit2Client(this.StartPoint), this.m_ptCur).Draw(xgraphics);
if (this.DrawSize)
{
double num = this.StartPoint.DistanceTo(xyz);
string text = string.Format("{0:F1}", num * 304.8);
PELineJig.DrawLineSize(base.Revit2Client(this.StartPoint), base.Revit2Client(xyz), text, xgraphics);
}
}
else
{
this.DrawMutilLine(this.StartPoint, xyz, xgraphics);
}
xgraphics.m_pen.Color = color;
return;
}
}
}
public override List<Curve> CreateCurves()
{
List<Curve> list = new List<Curve>();
try
{
if (this.StartPoint != null && this.EndPoint != null)
{
if (this.MutilLineDist.Count < 1)
{
list.Add(Line.CreateBound(this.StartPoint, this.EndPoint));
}
else
{
XYZ xyz = this.StartPoint;
XYZ xyz2 = this.EndPoint;
XYZ xyz3 = (xyz2 - xyz).Normalize();
XYZ xyz4 = Transform.CreateRotation(base.UiDoc.ActiveView.ViewDirection, -1.5707963267948966).OfVector(xyz3);
double num = 0.0;
foreach (double num2 in this.MutilLineDist)
{
num += num2;
}
double num3 = 0.0;
if (this.PointAlignType == PELineJig.AlignType.eRight)
{
num3 = num;
}
else if (this.PointAlignType == PELineJig.AlignType.eMiddle)
{
num3 = num / 2.0;
}
xyz -= xyz4 * num3;
xyz2 -= xyz4 * num3;
if (this.DrawEndLine)
{
XYZ xyz5 = xyz + xyz4 * num;
XYZ xyz6 = xyz2 + xyz4 * num;
list.Add(Line.CreateBound(xyz, xyz5));
list.Add(Line.CreateBound(xyz2, xyz6));
}
list.Add(Line.CreateBound(xyz, xyz2));
foreach (double num4 in this.MutilLineDist)
{
xyz += xyz4 * num4;
xyz2 += xyz4 * num4;
list.Add(Line.CreateBound(xyz, xyz2));
}
}
}
}
catch
{
}
return list;
}
public double LineAngle { get; set; }
public XYZ StartPoint { get; set; }
public XYZ EndPoint { get; set; }
public PELineJig.EStage JigStage { get; set; }
public XUiJigBase.EResetPoint ResetPoint { get; set; }
public Color DragLineColor { get; set; }
public PELineJig.AlignType PointAlignType { get; set; }
public List<double> MutilLineDist { get; set; }
public void DrawMutilLine(XYZ ptBaseS, XYZ ptBaseE, XGraphics graphics)
{
Transform transform = Transform.CreateRotation(base.UiDoc.ActiveView.ViewDirection, -1.5707963267948966);
XYZ xyz = (ptBaseE - ptBaseS).Normalize();
XYZ xyz2 = transform.OfVector(xyz);
double num = 0.0;
foreach (double num2 in this.MutilLineDist)
{
num += num2;
}
double num3 = 0.0;
if (this.PointAlignType == PELineJig.AlignType.eRight)
{
num3 = num;
}
else if (this.PointAlignType == PELineJig.AlignType.eMiddle)
{
num3 = num / 2.0;
}
ptBaseS -= xyz2 * num3;
ptBaseE -= xyz2 * num3;
if (this.DrawEndLine)
{
XYZ xyz3 = ptBaseS + xyz2 * num;
XYZ xyz4 = ptBaseE + xyz2 * num;
XLine2D xline2D = new XLine2D(base.Revit2Client(ptBaseS), base.Revit2Client(xyz3));
XDrawable2D xdrawable2D = new XLine2D(base.Revit2Client(ptBaseE), base.Revit2Client(xyz4));
xline2D.Draw(graphics);
xdrawable2D.Draw(graphics);
}
new XLine2D(base.Revit2Client(ptBaseS), base.Revit2Client(ptBaseE)).Draw(graphics);
foreach (double num4 in this.MutilLineDist)
{
ptBaseS += xyz2 * num4;
ptBaseE += xyz2 * num4;
new XLine2D(base.Revit2Client(ptBaseS), base.Revit2Client(ptBaseE)).Draw(graphics);
}
}
public bool DrawEndLine { get; set; }
public bool DrawSize { get; set; }
public static int SizeOffset { get; set; }
public static int BorderLength { get; set; }
public static Font SizeFont { get; set; }
public static StringFormat TextFormat { get; set; }
public static SolidBrush SizeTextBrush { get; set; }
public static Color SizeLineColor { get; set; }
public static void DrawLineSize(Point ptStart, Point ptEnd, string strSizeText, XGraphics graphics)
{
XUiJigBase.SortTwoPoint(ref ptStart, ref ptEnd);
if (XUiJigBase.TwoPointDist(ptStart, ptEnd) < 10)
{
return;
}
double num = XUiJigBase.TwoPointAngle(ptStart, ptEnd);
double num2 = num + 1.5707963267948966;
Color color = graphics.m_pen.Color;
graphics.m_pen.Color = PELineJig.SizeLineColor;
Point point = XUiJigBase.OffsetPoint(ptStart, num2, PELineJig.int_0);
Point point2 = XUiJigBase.OffsetPoint(ptEnd, num2, PELineJig.int_0);
Point point3 = XUiJigBase.OffsetPoint(point, num2, PELineJig.int_1 - PELineJig.int_0);
Point point4 = XUiJigBase.OffsetPoint(point2, num2, PELineJig.int_1 - PELineJig.int_0);
new XLine2D(XUiJigBase.OffsetPoint(point3, num, -PELineJig.int_0), XUiJigBase.OffsetPoint(point4, num, PELineJig.int_0)).Draw(graphics);
new XLine2D(XUiJigBase.OffsetPoint(point3, num + 45.0, PELineJig.int_0), XUiJigBase.OffsetPoint(point3, num + 45.0, -PELineJig.int_0)).Draw(graphics);
new XLine2D(XUiJigBase.OffsetPoint(point4, num + 45.0, PELineJig.int_0), XUiJigBase.OffsetPoint(point4, num + 45.0, -PELineJig.int_0)).Draw(graphics);
Point point5 = XUiJigBase.OffsetPoint(XUiJigBase.OffsetPoint(point, num, XUiJigBase.TwoPointDist(ptStart, ptEnd) / 2), num2, (int)((double)PELineJig.int_1 + (double)PELineJig.SizeFont.Height / 2.0));
PointF pointF = new PointF((float)point5.X, (float)point5.Y);
float num3 = -(float)(num / Math.PI * 180.0);
graphics.m_graphics.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
Matrix transform = graphics.m_graphics.Transform;
Matrix transform2 = graphics.m_graphics.Transform;
transform2.RotateAt(num3, pointF);
graphics.m_graphics.Transform = transform2;
graphics.m_graphics.DrawString(strSizeText, PELineJig.SizeFont, PELineJig.SizeTextBrush, pointF, PELineJig.TextFormat);
graphics.m_graphics.Transform = transform;
graphics.m_pen.Color = color;
}
public static void DrawLinesSize(Point ptStart, Point ptEnd, string strSizeText, XGraphics graphics)
{
XUiJigBase.SortTwoPoint(ref ptStart, ref ptEnd);
if (XUiJigBase.TwoPointDist(ptStart, ptEnd) < 10)
{
return;
}
double num = XUiJigBase.TwoPointAngle(ptStart, ptEnd);
double num2 = num + 1.5707963267948966;
Color color = graphics.m_pen.Color;
graphics.m_pen.Color = PELineJig.SizeLineColor;
Point point = XUiJigBase.OffsetPoint(ptStart, num2, PELineJig.int_0);
Point point2 = XUiJigBase.OffsetPoint(ptEnd, num2, PELineJig.int_0);
Point point3 = XUiJigBase.OffsetPoint(point, num2, PELineJig.int_1);
new XLine2D(point, point3).Draw(graphics);
Point point4 = XUiJigBase.OffsetPoint(point2, num2, PELineJig.int_1);
new XLine2D(point2, point4).Draw(graphics);
Point point5 = XUiJigBase.OffsetPoint(point, num2, PELineJig.int_1 - PELineJig.int_0);
Point point6 = XUiJigBase.OffsetPoint(point2, num2, PELineJig.int_1 - PELineJig.int_0);
new XLine2D(XUiJigBase.OffsetPoint(point5, num, -PELineJig.int_0), XUiJigBase.OffsetPoint(point6, num, PELineJig.int_0)).Draw(graphics);
new XLine2D(XUiJigBase.OffsetPoint(point5, num + 45.0, PELineJig.int_0), XUiJigBase.OffsetPoint(point5, num + 45.0, -PELineJig.int_0)).Draw(graphics);
new XLine2D(XUiJigBase.OffsetPoint(point6, num + 45.0, PELineJig.int_0), XUiJigBase.OffsetPoint(point6, num + 45.0, -PELineJig.int_0)).Draw(graphics);
Point point7 = XUiJigBase.OffsetPoint(XUiJigBase.OffsetPoint(point, num, XUiJigBase.TwoPointDist(ptStart, ptEnd) / 2), num2, (int)((double)PELineJig.int_1 + (double)PELineJig.SizeFont.Height / 2.0));
PointF pointF = new PointF((float)point7.X, (float)point7.Y);
float num3 = -(float)(num / Math.PI * 180.0);
graphics.m_graphics.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
Matrix transform = graphics.m_graphics.Transform;
Matrix transform2 = graphics.m_graphics.Transform;
transform2.RotateAt(num3, pointF);
graphics.m_graphics.Transform = transform2;
graphics.m_graphics.DrawString(strSizeText, PELineJig.SizeFont, PELineJig.SizeTextBrush, pointF, PELineJig.TextFormat);
graphics.m_graphics.Transform = transform;
graphics.m_pen.Color = color;
}
[CompilerGenerated]
private static int int_0;
[CompilerGenerated]
private static int int_1;
public enum EStage
{
eNoOper,
eStartPt,
eEndPt
}
public enum AlignType
{
eMiddle,
eLeft,
eRight
}
}
}

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BAD488E6-2D23-4792-834A-D9D947802CE8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>HongYe.HVAC</RootNamespace>
<AssemblyName>PlumbingElectricJigPro</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="RevitAPI">
<HintPath>C:\Program Files\Autodesk\Revit 2020\RevitAPI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPIUI">
<HintPath>C:\Program Files\Autodesk\Revit 2020\RevitAPIUI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<Compile Include="PELineJig.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HYJigPro\HYJigPro.csproj">
<Project>{33a04048-0a86-4711-abfe-dbb0df96a1fe}</Project>
<Name>HYJigPro</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,17 @@
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: ComVisible(false)]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: Guid("dad91cb1-64b6-42dd-98e5-66858aae3e09")]
[assembly: SuppressIldasm]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyTitle("PlumbingElectricJig")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlumbingElectricJig")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]