当前位置:网站首页>Revit secondary development - modify wall thickness
Revit secondary development - modify wall thickness
2022-07-07 22:22:00 【Hey, hey, hey, hey, hey】
The wall thickness is read-only , Can't modify , So we can only modify the layer thickness of its internal structure .
1、 Get the wall structure
2、 Get all layers , And traverse and modify the thickness
3、 The modified layer set is set to the structure , And set the structure to the wall type
The approximate code is as follows :
Wall wall;
double dThickness = 500 / 304.8;
double dHeight = wall.get_Prarmeter(BuiltInParameter.WALL_USER_HEIGHT_PARAM).AsDouble();
double dOffset = wall.get_Parameter(BuiltInParameter.WALL_BASE_OFFSET).AsDouble();
LocationCurve lc = wall.Location as LocationCurve;
Curve curve = lc.Curve;
using(Transaction trans = new Transaction(doc,"edit"))
{
trans.Start();
try
{
// Thickness type attribute , It is suggested to create a new wall type
WallType newType = wall.WallType.Duplicate("NewWallType") as WallType;
CompoundStructure cs = newType.GetCompoundStrycture();
// Get all layers
IList<CompoundStructureLayer> lstLayers = cs.GetLayers();
foreach(CompoundStructureLayer item in lstLayers)
{
if(item.Function == MaterialFunctionAssignment.Structure)
{// Only one structural layer is considered here , If there are more than one, calculate by yourself
item.Width = dThickness;
break;
}
}
// Set it again after modification
cs.SetLayers(lstLayers);
newType.SetCompoundStructure(cs);
Wall.Create(doc,curve,newType.Id,wall.LevelId,dHeight,dOffset,false,false);
doc.Delete(wall.Id);
trans.Commit();
}
catch
{
trans.RollBack();
}
}
边栏推荐
- Google SEO external chain backlinks research tool recommendation
- Interview question 01.02 Determine whether it is character rearrangement - auxiliary array algorithm
- Jerry's fast pairing does not support canceling pairing [article]
- [advanced MySQL] index details (I): index data page structure
- Two methods of calling WCF service by C #
- Jerry's power on automatic pairing [chapter]
- 强化学习-学习笔记9 | Multi-Step-TD-Target
- Attitude estimation (complementary filtering)
- [JDBC Part 1] overview, get connection, CRUD
- How to turn on win11 game mode? How to turn on game mode in win11
猜你喜欢
Add get disabled for RC form
用语雀写文章了,功能真心强大!
海外代理推荐
Blender exchange group, welcome to the water group ~
Reinforcement learning - learning notes 9 | multi step TD target
[open source] Net ORM accessing Firebird database
Anti climbing killer
Node:504 error reporting
UWA问答精选
Preparing for the interview and sharing experience
随机推荐
使用 CustomPaint 绘制基本图形
Ad domain group policy management
What is the difference between the three values of null Nan undefined in JS
OpenGL configure assimp
Tcp/ip protocol stack
Firefox browser installation impression notes clipping
Latest Android advanced interview questions summary, Android interview questions and answers
Use partial derivatives to display normals in unity
Google SEO external chain backlinks research tool recommendation
Display optimization when the resolution of easycvr configuration center video recording plan page is adjusted
Tsconfig of typescript TS basics JSON configuration options
Leetcode SQL first day
How does win11 time display the day of the week? How does win11 display the day of the week today?
This experimental syntax requires enabling the parser plugin: ‘optionalChaining‘
Ant destination multiple selection
【JDBC Part 1】概述、获取连接、CRUD
2022 how to evaluate and select low code development platforms?
Typescript TS basic knowledge type declaration
Win11游戏模式怎么开启?Win11开启游戏模式的方法
Build your own website (18)