Enclosed Region using Room Separator

Enclosed Region using Room Separator

Anonymous
不适用
2,006 次查看
5 条回复
1 条消息(共 6 条)

Enclosed Region using Room Separator

Anonymous
不适用

How can I programmatically create an enclosed space using Room Separators and assign Room object to it. Can somebody provide a sample code to work with Room Separator.

 

 

0 个赞
已接受的解答 (1)
2,007 次查看
5 条回复
回复 (5)
2 条消息(共 6 条)

atiefenbach
Advocate
Advocate
已接受的解答

This should get you going:

public void CreateRoomAndSeperators()
{
	Document doc = this.ActiveUIDocument.Document;
	View activeView = doc.ActiveView; //You should make sure you're in a Plan View
	
	XYZ pt1 = new XYZ(0, 0, 0);
	XYZ pt2 = new XYZ(0, 10, 0);
	XYZ pt3 = new XYZ(10, 10, 0);
	XYZ pt4 = new XYZ(10, 0, 0);
	
	UV pt5 = new UV(5, 5);
	
	CurveArray curveArray = new CurveArray();
	curveArray.Append(Line.CreateBound(pt1, pt2));
	curveArray.Append(Line.CreateBound(pt2, pt3));
	curveArray.Append(Line.CreateBound(pt3, pt4));
	curveArray.Append(Line.CreateBound(pt4, pt1));
	
	using (Transaction trans = new Transaction(doc))
	{
		trans.Start("Create Room and Boundaries");
		ModelCurveArray lines = doc.Create.NewRoomBoundaryLines(activeView.SketchPlane, curveArray, activeView);
		Room room = doc.Create.NewRoom(activeView.GenLevel, pt5);
		//now modify the "room" Element's Name, Number, etc.
		trans.Commit();
	}
}
Anthony Tiefenbach
BIM Manager
HuntonBrady Architects
3 条消息(共 6 条)

JimJia
Alumni
Alumni
Yes, NewRoomBoundaryLines() is the answer!

Thanks Anthony's code!

Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
4 条消息(共 6 条)

MiguelGT17
Advocate
Advocate

Some how the code doesnt work if I set the current view as a 3D view. Indeed, the following issue pops up:

MiguelGT17_0-1674145962203.png

 

0 个赞
5 条消息(共 6 条)

Tabeer_Tariq
Community Visitor
Community Visitor

Can this be done using dynamo only?

0 个赞
6 条消息(共 6 条)

AnthonyTiefenbach
Participant
Participant

I’m sure it’s possible, but you’d probably get a better answer in a Dynamo forum.

0 个赞