Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to arrange the hanger for Revit

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

这篇文章主要介绍了Revit怎么布置支吊架的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇Revit怎么布置支吊架文章都会有所收获,下面我们一起来看看吧。

------------------------------------我是思路-----------------------------

选择布置支吊架的距离

选择要布置支吊架的管子

我们先添加一个窗体,粗略设计一下窗体,大概就上面这样吧!

给窗体加上代码:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace zpx123

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

public void textBox1_TextChanged(object sender, EventArgs e)

{

string str = textBox1.Text;

}

private void button1_Click(object sender, EventArgs e)

{

this.DialogResult = DialogResult.OK;

}

public string Number

{

get { return textBox1.Text; }//获得文本框里返回的值

}

private void Form1_Load(object sender, EventArgs e)

{

}

}

}

正经的代码咯:

double number = 0;

int number1 = 0;

zpx123.Form1 form = new zpx123.Form1();

form.ShowDialog();

if (form.DialogResult == DialogResult.OK)

{

string str = form.Number;

//为了防止用户乱输入发生错误,我习惯踹一脚

try

{

number1 = Convert.ToInt32(str);

number = number1/304.8;

}

catch

{

MessageBox.Show("请输入正确的数字");

}

}

//通过以上这些就可以获得用户输入的数值了

ElementId id = null;

FilteredElementCollector faa = new FilteredElementCollector(doc);

faa.OfClass(typeof(FamilyInstance));//收集族类型

foreach (FamilyInstance fa in faa)

{

if (fa.GetParameters("族与类型")[0].AsValueString().Contains("支吊架"))

{

id = fa.Symbol.Id;

}

}

FamilySymbol fas = doc.GetElement(id) as FamilySymbol;

Selection ree = uiDoc.Selection;

Reference re = ree.PickObject(ObjectType.Element);

Element elem = doc.GetElement(re);

Pipe pipe = elem as Pipe;

LocationCurve curve = pipe.Location as LocationCurve;

XYZ start = curve.Curve.GetEndPoint(0);//获取管道的起点

XYZ end = curve.Curve.GetEndPoint(1);//获得管道的终点

double a = start.X ;

double b = start.Y ;

double zz = start.Z ;

double c = end.X ;

double d = end.Y ;

//以上是获得管道起点和终点的xyz的值

double xy = start.DistanceTo(end) ;//求距离

int gs = (int)((xy / number));//求要放几个支吊架

double y = (number * (d - b)) / Math.Sqrt((c - a) * (c - a) + (d - b) * (d - b)) ;

double x = (number * (c - a)) / Math.Sqrt((c - a) * (c - a) + (d - b) * (d - b)) ;

//以上为数学公式

List listt = new List();

//用来存储一系列的管道坐标的集合

for (double j = 0; j

< gs; j ++) { double A = a + x; double B = b + y; listt.Add(new FamilyInstanceCreationData(new XYZ(A, B, zz), fas, StructuralType.NonStructural));//把坐标放到集合里 a = A; b = B; } doc.Create.NewFamilyInstances2(listt);//创建支吊架 ts.Commit(); return Result.Succeeded; } } } (代码有点长,我试了一下,截屏没办法把代码都截进去,只能分成几个图片了) 效果展示:

Click Done to select Pipeline.

The content of this article on "How to arrange supports and hangers in Revit" is introduced here. Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to arrange supports and hangers in Revit." If you still want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report