当前位置:网站首页>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();
}
}
边栏推荐
- Ternary expressions, generative expressions, anonymous functions
- What if the win11u disk does not display? Solution to failure of win11 plug-in USB flash disk
- Crawler (17) - Interview (2) | crawler interview question bank
- 【colmap】稀疏重建转为MVSNet格式输入
- Jerry's about TWS pairing mode configuration [chapter]
- PDF文档签名指南
- vite Unrestricted file system access to
- 如何选择合适的自动化测试工具?
- Dbsync adds support for mongodb and ES
- Customer case | China law network, through observing the cloud, greatly shortens the time of fault location
猜你喜欢
客户案例|华律网,通过观测云大幅缩短故障定位时间
如何选择合适的自动化测试工具?
【Azure微服务 Service Fabric 】在SF节点中开启Performance Monitor及设置抓取进程的方式
Px4 autonomous flight
海外代理推荐
How to turn on win11 game mode? How to turn on game mode in win11
ByteDance senior engineer interview, easy to get started, fluent
Win11U盘不显示怎么办?Win11插U盘没反应的解决方法
Paint basic graphics with custompaint
[JDBC Part 1] overview, get connection, CRUD
随机推荐
[开源] .Net ORM 访问 Firebird 数据库
23. Merge K ascending linked lists -c language
Open source OA development platform: contract management user manual
【Azure微服务 Service Fabric 】因证书过期导致Service Fabric集群挂掉(升级无法完成,节点不可用)
用语雀写文章了,功能真心强大!
Preparing for the interview and sharing experience
Which futures company is the safest to open a futures account?
Get the week start time and week end time of the current date
SAR影像质量评估
Win11游戏模式怎么开启?Win11开启游戏模式的方法
变量与常量
谈谈制造企业如何制定敏捷的数字化转型策略
[azure microservice service fabric] how to transfer seed nodes in the service fabric cluster
This experimental syntax requires enabling the parser plugin: ‘optionalChaining‘
The difference between NPM uninstall and RM direct deletion
强化学习-学习笔记9 | Multi-Step-TD-Target
Attitude estimation (complementary filtering)
The strongest installation of the twin tower model, Google is playing "antique" again?
Pre sale 179000, hengchi 5 can fire? Product power online depends on how it is sold
Display optimization when the resolution of easycvr configuration center video recording plan page is adjusted