using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
// 为AutoCAD应用添加别名
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
namespace BeamSectionPlugin
{
public class BeamSectionDrawer
{
private static BeamSettings settings = new BeamSettings();
private static readonly HashSet<string> loadedDatabases = new HashSet<string>();
[CommandMethod("DB")]
public void DrawBeamSection()
{
Document doc = AcadApp.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = doc.Database;
// 加载设置窗体
DialogResult dialogResult;
using (var form = new SettingsForm(settings))
{
dialogResult = AcadApp.ShowModalDialog(form);
}
if (dialogResult != DialogResult.OK) return;
// 启用对象捕捉
using (var osnap = new ObjectSnapMode(ed, ObjectSnapMode.Mode.End | ObjectSnapMode.Mode.Mid | ObjectSnapMode.Mode.Cen))
{
while (true)
{
try
{
// 获取梁的第一点
PromptPointResult firstPointRes = ed.GetPoint("\n请点击梁的第一点: ");
if (firstPointRes.Status != PromptStatus.OK) return;
// 获取梁的第二点(带选项)
PromptPointOptions secondPointOpts = new PromptPointOptions("\n请点击梁的第二点[板厚(A)升降板(S)]: ");
secondPointOpts.Keywords.Add("A");
secondPointOpts.Keywords.Add("S");
secondPointOpts.AllowNone = true;
secondPointOpts.UseBasePoint = true;
secondPointOpts.BasePoint = firstPointRes.Value;
PromptPointResult secondPointRes = ed.GetPoint(secondPointOpts);
if (secondPointRes.Status == PromptStatus.Keyword)
{
if (secondPointRes.StringResult == "A")
{
PromptDoubleOptions pdo = new PromptDoubleOptions("\n输入板厚(mm)<120>: ");
pdo.DefaultValue = 120;
pdo.UseDefaultValue = true;
PromptDoubleResult slabThicknessRes = ed.GetDouble(pdo);
if (slabThicknessRes.Status != PromptStatus.OK) return;
settings.SlabThickness = slabThicknessRes.Value;
}
else if (secondPointRes.StringResult == "S")
{
PromptDoubleOptions pdo = new PromptDoubleOptions("\n请输入升降板高度(升板为正数,降板为负数)mm<0.00>: ");
pdo.DefaultValue = 0;
pdo.UseDefaultValue = true;
PromptDoubleResult slabHeightRes = ed.GetDouble(pdo);
if (slabHeightRes.Status != PromptStatus.OK) return;
settings.SlabHeightOffset = slabHeightRes.Value;
}
secondPointRes = ed.GetPoint("\n请点击梁的第二点: ");
}
if (secondPointRes.Status != PromptStatus.OK) return;
// 获取梁高
PromptDoubleOptions heightOpts = new PromptDoubleOptions("\n请输入梁高(mm): ");
PromptDoubleResult beamHeightRes = ed.GetDouble(heightOpts);
if (beamHeightRes.Status != PromptStatus.OK) return;
double beamHeight = beamHeightRes.Value;
// 预加载所需块
LoadSupportBlocks(db, new[] {
"ScaffoldPole梁侧模",
"ScaffoldPole断面木方",
"ScaffoldPole断面方钢",
"ScaffoldPole横向龙骨"
});
// 绘制梁侧模
if (settings.DrawBeamFormwork)
DrawBeamFormwork(db, firstPointRes.Value, secondPointRes.Value, beamHeight);
// 绘制板下龙骨
if (settings.DrawSlabSupport)
DrawSlabSupport(db, firstPointRes.Value, secondPointRes.Value, beamHeight);
}
catch (System.Exception ex)
{
ed.WriteMessage($"\n错误: {ex.Message}\n{ex.StackTrace}");
}
}
}
}
private void LoadSupportBlocks(Database db, IEnumerable<string> requiredBlocks)
{
string dbKey = db.Filename;
if (string.IsNullOrEmpty(dbKey))
dbKey = db.GetHashCode().ToString(); // 使用哈希码替代Handle
if (loadedDatabases.Contains(dbKey))
return;
string blockFilePath = FindBlockFile();
if (string.IsNullOrEmpty(blockFilePath))
{
loadedDatabases.Add(dbKey);
throw new FileNotFoundException("支撑块定义文件ScaffoldBlocks.dwg未找到");
}
using (Database sourceDb = new Database(false, true))
{
sourceDb.ReadDwgFile(blockFilePath, FileOpenMode.OpenForReadAndAllShare, false, null);
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
foreach (string blockName in requiredBlocks)
{
if (!bt.Has(blockName))
{
// 复制块定义
db.Insert(blockName, sourceDb, true);
}
}
tr.Commit();
}
}
loadedDatabases.Add(dbKey);
}
private string FindBlockFile()
{
// 1. 检查当前目录
string currentDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string blockFile = Path.Combine(currentDir, "ScaffoldBlocks.dwg");
if (File.Exists(blockFile)) return blockFile;
// 2. 检查AutoCAD支持路径
string acadPaths = AcadApp.GetSystemVariable("SUPPORT") as string;
if (!string.IsNullOrEmpty(acadPaths))
{
foreach (string path in acadPaths.Split(';'))
{
blockFile = Path.Combine(path, "ScaffoldBlocks.dwg");
if (File.Exists(blockFile)) return blockFile;
}
}
// 3. 检查插件目录
string pluginDir = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"Autodesk",
"ApplicationPlugins",
"BeamSectionPlugin.bundle"
);
blockFile = Path.Combine(pluginDir, "ScaffoldBlocks.dwg");
if (File.Exists(blockFile)) return blockFile;
return null;
}
private void DrawBeamFormwork(Database db, Point3d start, Point3d end, double height)
{
double length = start.DistanceTo(end);
double halfLength = length / 2;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
const string beamBlockName = "ScaffoldPole梁侧模";
if (!bt.Has(beamBlockName))
throw new InvalidOperationException($"找不到图块 '{beamBlockName}'");
BlockReference beamRef = new BlockReference(start, bt[beamBlockName]);
btr.AppendEntity(beamRef);
tr.AddNewlyCreatedDBObject(beamRef, true);
// 设置动态块参数
foreach (DynamicBlockReferenceProperty prop in beamRef.DynamicBlockReferencePropertyCollection)
{
switch (prop.PropertyName)
{
case "宽度左侧": prop.Value = halfLength; break;
case "宽度右侧": prop.Value = halfLength; break;
case "左高度": prop.Value = height; break;
case "右高度": prop.Value = height; break;
case "次龙骨宽": prop.Value = settings.BeamSecondaryWidth; break;
case "次龙骨高": prop.Value = settings.BeamSecondaryHeight; break;
}
}
// 旋转图块
Vector3d direction = end - start;
double angle = direction.GetAngleTo(Vector3d.XAxis);
beamRef.TransformBy(Matrix3d.Rotation(angle, Vector3d.ZAxis, start));
tr.Commit();
}
}
private void DrawSlabSupport(Database db, Point3d beamStart, Point3d beamEnd, double beamHeight)
{
Vector3d beamDirection = (beamEnd - beamStart).GetNormal();
double beamLength = beamStart.DistanceTo(beamEnd);
// 计算板底位置
double slabZOffset = beamHeight + settings.SlabThickness + settings.SlabHeightOffset;
Point3d slabStart = new Point3d(beamStart.X, beamStart.Y, beamStart.Z + slabZOffset);
Point3d slabEnd = new Point3d(beamEnd.X, beamEnd.Y, beamEnd.Z + slabZOffset);
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
if (settings.SlabMainDirection == "横向")
{
// 横向龙骨:阵列次龙骨
int arrayCount = (int)Math.Floor(beamLength / settings.SlabSecondarySpacing) + 1;
double spacing = beamLength / (arrayCount - 1);
string blockName = settings.SlabSecondaryMaterial.Contains("木方")
? "ScaffoldPole断面木方"
: "ScaffoldPole断面方钢";
if (!bt.Has(blockName))
throw new InvalidOperationException($"找不到图块 '{blockName}'");
for (int i = 0; i < arrayCount; i++)
{
Point3d position = slabStart + (beamDirection * (i * spacing));
BlockReference supportRef = new BlockReference(position, bt[blockName]);
btr.AppendEntity(supportRef);
tr.AddNewlyCreatedDBObject(supportRef, true);
// 设置材料可见性和尺寸
foreach (DynamicBlockReferenceProperty prop in supportRef.DynamicBlockReferencePropertyCollection)
{
switch (prop.PropertyName)
{
case "材料": prop.Value = settings.SlabSecondaryMaterial; break;
case "宽度": prop.Value = settings.SlabSecondaryWidth; break;
case "高度": prop.Value = settings.SlabSecondaryHeight; break;
}
}
}
}
else
{
// 纵向龙骨:单根横向龙骨
const string slabBlockName = "ScaffoldPole横向龙骨";
if (!bt.Has(slabBlockName))
throw new InvalidOperationException($"找不到图块 '{slabBlockName}'");
Point3d center = new Point3d(
(slabStart.X + slabEnd.X) / 2,
(slabStart.Y + slabEnd.Y) / 2,
slabStart.Z
);
BlockReference supportRef = new BlockReference(center, bt[slabBlockName]);
btr.AppendEntity(supportRef);
tr.AddNewlyCreatedDBObject(supportRef, true);
// 设置长度属性和尺寸
foreach (DynamicBlockReferenceProperty prop in supportRef.DynamicBlockReferencePropertyCollection)
{
switch (prop.PropertyName)
{
case "长度": prop.Value = beamLength; break;
case "材料": prop.Value = settings.SlabSecondaryMaterial; break;
case "次龙骨宽": prop.Value = settings.SlabSecondaryWidth; break;
case "次龙骨高": prop.Value = settings.SlabSecondaryHeight; break;
}
}
// 旋转方向
Vector3d dir = beamEnd - beamStart;
double angle = dir.GetAngleTo(Vector3d.XAxis);
supportRef.TransformBy(Matrix3d.Rotation(angle, Vector3d.ZAxis, center));
}
tr.Commit();
}
}
}
// 辅助类:对象捕捉模式管理
public class ObjectSnapMode : IDisposable
{
private readonly Editor _editor;
private readonly int _oldOsnapMode;
[Flags]
public enum Mode
{
None = 0,
End = 1,
Mid = 2,
Cen = 4,
Node = 8,
Quad = 16,
Int = 32,
Ins = 64,
Per = 128,
Tan = 256,
Near = 512,
Geo = 1024,
App = 2048,
Ext = 4096,
Par = 8192
}
public ObjectSnapMode(Editor editor, Mode modes)
{
_editor = editor;
_oldOsnapMode = Convert.ToInt32(AcadApp.GetSystemVariable("OSMODE"));
AcadApp.SetSystemVariable("OSMODE", (int)modes);
}
public void Dispose()
{
AcadApp.SetSystemVariable("OSMODE", (short)_oldOsnapMode);
}
}
public class BeamSettings
{
public bool DrawBeamFormwork { get; set; } = true;
public bool DrawBeamSupport { get; set; } = true;
public string BeamMainDirection { get; set; } = "横向";
public double BeamExtension { get; set; } = 50;
public string BeamMainMaterial { get; set; } = "100方钢";
public string BeamSecondaryMaterial { get; set; } = "50木方";
public double BeamSecondarySpacing { get; set; } = 100;
// 新增次龙骨尺寸属性
public double BeamSecondaryHeight { get; set; } = 90;
public double BeamSecondaryWidth { get; set; } = 40;
public double SlabThickness { get; set; } = 250;
public bool DrawSlabSupport { get; set; } = true;
public string SlabMainDirection { get; set; } = "横向";
public bool KeepSupport { get; set; } = true;
public string SlabMainMaterial { get; set; } = "100方钢";
public string SlabSecondaryMaterial { get; set; } = "3木方";
public double SlabSecondarySpacing { get; set; } = 250;
// 新增次龙骨尺寸属性
public double SlabSecondaryHeight { get; set; } = 90;
public double SlabSecondaryWidth { get; set; } = 40;
public double SlabHeightOffset { get; set; } = 0;
}
public class SettingsForm : Form
{
private BeamSettings settings;
public SettingsForm(BeamSettings settings)
{
this.settings = settings;
InitializeForm(); // 修复:调用正确的初始化方法
this.FormClosing += SettingsForm_FormClosing;
}
private void SettingsForm_FormClosing(object sender, FormClosingEventArgs e)
{
// 保存窗体数据到settings对象
SaveFormData();
}
private void SaveFormData()
{
// 实际保存逻辑应在窗体关闭前处理
// 此方法目前为空,需要根据实际控件状态更新settings
}
// 修复:添加InitializeForm方法
private void InitializeForm()
{
this.Text = "梁板剖面绘制参数设置";
this.Size = new System.Drawing.Size(305, 560); // 增加高度以适应新控件
this.FormBorderStyle = FormBorderStyle.FixedDialog;
this.StartPosition = FormStartPosition.CenterScreen;
TabControl tabControl = new TabControl();
tabControl.Dock = DockStyle.Fill;
// 梁下龙骨选项卡
TabPage beamTab = new TabPage("梁下龙骨");
InitializeBeamTab(beamTab);
// 板下龙骨选项卡
TabPage slabTab = new TabPage("板下龙骨");
InitializeSlabTab(slabTab);
tabControl.TabPages.Add(beamTab);
tabControl.TabPages.Add(slabTab);
// 按钮面板
Panel buttonPanel = new Panel();
buttonPanel.Dock = DockStyle.Bottom;
buttonPanel.Height = 40;
Button okButton = new Button();
okButton.Text = "开始绘制";
okButton.DialogResult = DialogResult.OK;
okButton.Location = new System.Drawing.Point(50, 10);
Button cancelButton = new Button();
cancelButton.Text = "取消";
cancelButton.DialogResult = DialogResult.Cancel;
cancelButton.Location = new System.Drawing.Point(150, 10);
buttonPanel.Controls.Add(okButton);
buttonPanel.Controls.Add(cancelButton);
this.Controls.Add(tabControl);
this.Controls.Add(buttonPanel);
}
private void InitializeBeamTab(TabPage tab)
{
tab.Controls.Clear();
tab.AutoScroll = true;
int yPos = 20;
// 绘制梁侧模
GroupBox gbBeamFormwork = new GroupBox();
gbBeamFormwork.Text = "绘制梁侧模";
gbBeamFormwork.Location = new System.Drawing.Point(20, yPos);
gbBeamFormwork.Size = new System.Drawing.Size(250, 50);
RadioButton rbBeamFormworkYes = new RadioButton();
rbBeamFormworkYes.Text = "是";
rbBeamFormworkYes.Checked = settings.DrawBeamFormwork;
rbBeamFormworkYes.Location = new System.Drawing.Point(20, 20);
RadioButton rbBeamFormworkNo = new RadioButton();
rbBeamFormworkNo.Text = "否";
rbBeamFormworkNo.Checked = !settings.DrawBeamFormwork;
rbBeamFormworkNo.Location = new System.Drawing.Point(150, 20);
gbBeamFormwork.Controls.Add(rbBeamFormworkYes);
gbBeamFormwork.Controls.Add(rbBeamFormworkNo);
tab.Controls.Add(gbBeamFormwork);
yPos += 60;
// 绘制梁龙骨
GroupBox gbBeamSupport = new GroupBox();
gbBeamSupport.Text = "绘制梁龙骨";
gbBeamSupport.Location = new System.Drawing.Point(20, yPos);
gbBeamSupport.Size = new System.Drawing.Size(250, 50);
RadioButton rbBeamSupportYes = new RadioButton();
rbBeamSupportYes.Text = "是";
rbBeamSupportYes.Checked = settings.DrawBeamSupport;
rbBeamSupportYes.Location = new System.Drawing.Point(20, 20);
RadioButton rbBeamSupportNo = new RadioButton();
rbBeamSupportNo.Text = "否";
rbBeamSupportNo.Checked = !settings.DrawBeamSupport;
rbBeamSupportNo.Location = new System.Drawing.Point(150, 20);
gbBeamSupport.Controls.Add(rbBeamSupportYes);
gbBeamSupport.Controls.Add(rbBeamSupportNo);
tab.Controls.Add(gbBeamSupport);
yPos += 60;
// 主龙骨方向
GroupBox gbBeamDirection = new GroupBox();
gbBeamDirection.Text = "主龙骨方向";
gbBeamDirection.Location = new System.Drawing.Point(20, yPos);
gbBeamDirection.Size = new System.Drawing.Size(250, 100);
RadioButton rbBeamHorizontal = new RadioButton();
rbBeamHorizontal.Text = "横向";
rbBeamHorizontal.Checked = (settings.BeamMainDirection == "横向");
rbBeamHorizontal.Location = new System.Drawing.Point(20, 20);
RadioButton rbBeamVertical = new RadioButton();
rbBeamVertical.Text = "纵向";
rbBeamVertical.Checked = (settings.BeamMainDirection == "纵向");
rbBeamVertical.Location = new System.Drawing.Point(150, 20);
Label lblBeamExtension = new Label();
lblBeamExtension.Text = "横龙骨延伸宽度(mm):";
lblBeamExtension.Location = new System.Drawing.Point(20, 60);
TextBox tbBeamExtension = new TextBox();
tbBeamExtension.Text = settings.BeamExtension.ToString();
tbBeamExtension.Location = new System.Drawing.Point(150, 60);
tbBeamExtension.Width = 80;
gbBeamDirection.Controls.Add(rbBeamHorizontal);
gbBeamDirection.Controls.Add(rbBeamVertical);
gbBeamDirection.Controls.Add(lblBeamExtension);
gbBeamDirection.Controls.Add(tbBeamExtension);
tab.Controls.Add(gbBeamDirection);
yPos += 100;
// 材料设置
GroupBox gbBeamMaterial = new GroupBox();
gbBeamMaterial.Text = "材料设置";
gbBeamMaterial.Location = new System.Drawing.Point(20, yPos);
gbBeamMaterial.Size = new System.Drawing.Size(250, 210); // 增加高度以容纳新控件
Label lblBeamMainMaterial = new Label();
lblBeamMainMaterial.Text = "主龙骨:";
lblBeamMainMaterial.Location = new System.Drawing.Point(20, 30);
ComboBox cbBeamMainMaterial = new ComboBox();
cbBeamMainMaterial.Items.AddRange(new object[] { "3木方", "5大方", "50钢包木", "48钢管", "40方钢", "50方钢", "100方钢", "8#槽钢", "10#槽钢" });
cbBeamMainMaterial.Text = settings.BeamMainMaterial;
cbBeamMainMaterial.Location = new System.Drawing.Point(120, 25);
cbBeamMainMaterial.Width = 100;
Label lblBeamSecondaryMaterial = new Label();
lblBeamSecondaryMaterial.Text = "次龙骨:";
lblBeamSecondaryMaterial.Location = new System.Drawing.Point(20, 70);
ComboBox cbBeamSecondaryMaterial = new ComboBox();
cbBeamSecondaryMaterial.Items.AddRange(new object[] { "3木方", "5大方", "50钢包木", "48钢管", "40方钢", "50方钢", "100方钢", "8#槽钢", "10#槽钢" });
cbBeamSecondaryMaterial.Text = settings.BeamSecondaryMaterial;
cbBeamSecondaryMaterial.Location = new System.Drawing.Point(120, 65);
cbBeamSecondaryMaterial.Width = 100;
Label lblBeamSecondarySpacing = new Label();
lblBeamSecondarySpacing.Text = "次龙骨间距(mm):";
lblBeamSecondarySpacing.Location = new System.Drawing.Point(20, 110);
TextBox tbBeamSecondarySpacing = new TextBox();
tbBeamSecondarySpacing.Text = settings.BeamSecondarySpacing.ToString();
tbBeamSecondarySpacing.Location = new System.Drawing.Point(120, 105);
tbBeamSecondarySpacing.Width = 100;
// 新增次龙骨宽度设置
Label lblBeamSecondaryWidth = new Label();
lblBeamSecondaryWidth.Text = "次龙骨宽(mm):";
lblBeamSecondaryWidth.Location = new System.Drawing.Point(20, 150);
TextBox tbBeamSecondaryWidth = new TextBox();
tbBeamSecondaryWidth.Text = settings.BeamSecondaryWidth.ToString();
tbBeamSecondaryWidth.Location = new System.Drawing.Point(120, 145);
tbBeamSecondaryWidth.Width = 100;
// 新增次龙骨高度设置
Label lblBeamSecondaryHeight = new Label();
lblBeamSecondaryHeight.Text = "次龙骨高(mm):";
lblBeamSecondaryHeight.Location = new System.Drawing.Point(20, 180);
TextBox tbBeamSecondaryHeight = new TextBox();
tbBeamSecondaryHeight.Text = settings.BeamSecondaryHeight.ToString();
tbBeamSecondaryHeight.Location = new System.Drawing.Point(120, 175);
tbBeamSecondaryHeight.Width = 100;
gbBeamMaterial.Controls.Add(lblBeamMainMaterial);
gbBeamMaterial.Controls.Add(cbBeamMainMaterial);
gbBeamMaterial.Controls.Add(lblBeamSecondaryMaterial);
gbBeamMaterial.Controls.Add(cbBeamSecondaryMaterial);
gbBeamMaterial.Controls.Add(lblBeamSecondarySpacing);
gbBeamMaterial.Controls.Add(tbBeamSecondarySpacing);
gbBeamMaterial.Controls.Add(lblBeamSecondaryWidth);
gbBeamMaterial.Controls.Add(tbBeamSecondaryWidth);
gbBeamMaterial.Controls.Add(lblBeamSecondaryHeight);
gbBeamMaterial.Controls.Add(tbBeamSecondaryHeight);
tab.Controls.Add(gbBeamMaterial);
}
private void InitializeSlabTab(TabPage tab)
{
tab.Controls.Clear();
tab.AutoScroll = true;
int yPos = 20;
// 默认板厚
GroupBox gbSlabThickness = new GroupBox();
gbSlabThickness.Text = "板厚设置";
gbSlabThickness.Location = new System.Drawing.Point(20, yPos);
gbSlabThickness.Size = new System.Drawing.Size(250, 60);
TextBox tbSlabThickness = new TextBox();
tbSlabThickness.Text = settings.SlabThickness.ToString();
tbSlabThickness.Location = new System.Drawing.Point(150, 20);
tbSlabThickness.Width = 80;
gbSlabThickness.Controls.Add(new Label()
{
Text = "默认板厚(mm):",
Location = new System.Drawing.Point(20, 25)
});
gbSlabThickness.Controls.Add(tbSlabThickness);
tab.Controls.Add(gbSlabThickness);
yPos += 70;
// 绘制板龙骨
GroupBox gbDrawSlabSupport = new GroupBox();
gbDrawSlabSupport.Text = "绘制板龙骨";
gbDrawSlabSupport.Location = new System.Drawing.Point(20, yPos);
gbDrawSlabSupport.Size = new System.Drawing.Size(250, 60);
RadioButton rbSlabSupportYes = new RadioButton();
rbSlabSupportYes.Text = "是";
rbSlabSupportYes.Checked = settings.DrawSlabSupport;
rbSlabSupportYes.Location = new System.Drawing.Point(20, 25);
RadioButton rbSlabSupportNo = new RadioButton();
rbSlabSupportNo.Text = "否";
rbSlabSupportNo.Checked = !settings.DrawSlabSupport;
rbSlabSupportNo.Location = new System.Drawing.Point(150, 25);
gbDrawSlabSupport.Controls.Add(rbSlabSupportYes);
gbDrawSlabSupport.Controls.Add(rbSlabSupportNo);
tab.Controls.Add(gbDrawSlabSupport);
yPos += 70;
// 主龙骨方向
GroupBox gbSlabDirection = new GroupBox();
gbSlabDirection.Text = "主龙骨方向";
gbSlabDirection.Location = new System.Drawing.Point(20, yPos);
gbSlabDirection.Size = new System.Drawing.Size(250, 60);
RadioButton rbSlabHorizontal = new RadioButton();
rbSlabHorizontal.Text = "横向";
rbSlabHorizontal.Checked = (settings.SlabMainDirection == "横向");
rbSlabHorizontal.Location = new System.Drawing.Point(20, 25);
RadioButton rbSlabVertical = new RadioButton();
rbSlabVertical.Text = "纵向";
rbSlabVertical.Checked = (settings.SlabMainDirection == "纵向");
rbSlabVertical.Location = new System.Drawing.Point(150, 25);
gbSlabDirection.Controls.Add(rbSlabHorizontal);
gbSlabDirection.Controls.Add(rbSlabVertical);
tab.Controls.Add(gbSlabDirection);
yPos += 70;
// 次龙骨设置
GroupBox gbSlabSecondary = new GroupBox();
gbSlabSecondary.Text = "龙骨设置";
gbSlabSecondary.Location = new System.Drawing.Point(20, yPos);
gbSlabSecondary.Size = new System.Drawing.Size(250, 210); // 增加高度以容纳新控件
Label lblSlabMainMaterial = new Label();
lblSlabMainMaterial.Text = "主龙骨材料:";
lblSlabMainMaterial.Location = new System.Drawing.Point(20, 30);
ComboBox cbSlabMainMaterial = new ComboBox();
cbSlabMainMaterial.Items.AddRange(new object[] { "3木方", "5大方", "50钢包木", "48钢管", "40方钢", "50方钢", "100方钢", "8#槽钢", "10#槽钢" });
cbSlabMainMaterial.Text = settings.SlabMainMaterial;
cbSlabMainMaterial.Location = new System.Drawing.Point(120, 25);
cbSlabMainMaterial.Width = 100;
Label lblSlabSecondaryMaterial = new Label();
lblSlabSecondaryMaterial.Text = "次龙骨材料:";
lblSlabSecondaryMaterial.Location = new System.Drawing.Point(20, 70);
ComboBox cbSlabSecondaryMaterial = new ComboBox();
cbSlabSecondaryMaterial.Items.AddRange(new object[] { "3木方", "5大方", "50钢包木", "48钢管", "40方钢", "50方钢", "100方钢", "8#槽钢", "10#槽钢" });
cbSlabSecondaryMaterial.Text = settings.SlabSecondaryMaterial;
cbSlabSecondaryMaterial.Location = new System.Drawing.Point(120, 65);
cbSlabSecondaryMaterial.Width = 100;
Label lblSlabSpacing = new Label();
lblSlabSpacing.Text = "次龙骨间距(mm):";
lblSlabSpacing.Location = new System.Drawing.Point(20, 110);
TextBox tbSlabSpacing = new TextBox();
tbSlabSpacing.Text = settings.SlabSecondarySpacing.ToString();
tbSlabSpacing.Location = new System.Drawing.Point(120, 105);
tbSlabSpacing.Width = 100;
// 新增次龙骨宽度设置
Label lblSlabSecondaryWidth = new Label();
lblSlabSecondaryWidth.Text = "次龙骨宽(mm):";
lblSlabSecondaryWidth.Location = new System.Drawing.Point(20, 150);
TextBox tbSlabSecondaryWidth = new TextBox();
tbSlabSecondaryWidth.Text = settings.SlabSecondaryWidth.ToString();
tbSlabSecondaryWidth.Location = new System.Drawing.Point(120, 145);
tbSlabSecondaryWidth.Width = 100;
// 新增次龙骨高度设置
Label lblSlabSecondaryHeight = new Label();
lblSlabSecondaryHeight.Text = "次龙骨高(mm):";
lblSlabSecondaryHeight.Location = new System.Drawing.Point(20, 180);
TextBox tbSlabSecondaryHeight = new TextBox();
tbSlabSecondaryHeight.Text = settings.SlabSecondaryHeight.ToString();
tbSlabSecondaryHeight.Location = new System.Drawing.Point(120, 175);
tbSlabSecondaryHeight.Width = 100;
gbSlabSecondary.Controls.Add(lblSlabMainMaterial);
gbSlabSecondary.Controls.Add(cbSlabMainMaterial);
gbSlabSecondary.Controls.Add(lblSlabSecondaryMaterial);
gbSlabSecondary.Controls.Add(cbSlabSecondaryMaterial);
gbSlabSecondary.Controls.Add(lblSlabSpacing);
gbSlabSecondary.Controls.Add(tbSlabSpacing);
gbSlabSecondary.Controls.Add(lblSlabSecondaryWidth);
gbSlabSecondary.Controls.Add(tbSlabSecondaryWidth);
gbSlabSecondary.Controls.Add(lblSlabSecondaryHeight);
gbSlabSecondary.Controls.Add(tbSlabSecondaryHeight);
tab.Controls.Add(gbSlabSecondary);
}
}
}
命令: NETLOAD
命令: DB
请点击梁的第一点: >>选项卡索引 <0>:
正在恢复执行 DB 命令。
请点击梁的第一点:
请点击梁的第二点[板厚(A)升降板(S)] [A/S]:
请输入梁高(mm): 1000
错误: eInvalidInput
在 Autodesk.AutoCAD.ApplicationServices.Core.Application.GetSystemVariable(String name)
在 BeamSectionPlugin.BeamSectionDrawer.FindBlockFile() 位置 C:\Users\卓越生活\Desktop\梁板剖面绘制2\梁板剖面绘制\Class1.cs:行号 158
在 BeamSectionPlugin.BeamSectionDrawer.LoadSupportBlocks(Database db, IEnumerable`1 requiredBlocks) 位置 C:\Users\卓越生活\Desktop\梁板剖面绘制2\梁板剖面绘制\Class1.cs:行号 121
在 BeamSectionPlugin.BeamSectionDrawer.DrawBeamSection() 位置 C:\Users\卓越生活\Desktop\梁板剖面绘制2\梁板剖面绘制\Class1.cs:行号 89
请点击梁的第一点:
请点击梁的第二点[板厚(A)升降板(S)] [A/S]:
请输入梁高(mm): 1000
错误: eInvalidInput
在 Autodesk.AutoCAD.ApplicationServices.Core.Application.GetSystemVariable(String name)
在 BeamSectionPlugin.BeamSectionDrawer.FindBlockFile() 位置 C:\Users\卓越生活\Desktop\梁板剖面绘制2\梁板剖面绘制\Class1.cs:行号 158
在 BeamSectionPlugin.BeamSectionDrawer.LoadSupportBlocks(Database db, IEnumerable`1 requiredBlocks) 位置 C:\Users\卓越生活\Desktop\梁板剖面绘制2\梁板剖面绘制\Class1.cs:行号 121
在 BeamSectionPlugin.BeamSectionDrawer.DrawBeamSection() 位置 C:\Users\卓越生活\Desktop\梁板剖面绘制2\梁板剖面绘制\Class1.cs:行号 89
请点击梁的第一点: *取消*
最新发布