本文整理汇总了Python中Autodesk.Revit.DB.ElementId方法的典型用法代码示例。如果您正苦于以下问题:Python DB.ElementId方法的具体用法?Python DB.ElementId怎么用?Python DB.ElementId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Autodesk.Revit.DB
的用法示例。
在下文中一共展示了DB.ElementId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getElement
# 需要导入模块: from Autodesk.Revit import DB [as 别名]
# 或者: from Autodesk.Revit.DB import ElementId [as 别名]
def getElement(i):
try: return doc.GetElement(ElementId(i)).ToDSType(1)
except: return i
示例2: NewDS
# 需要导入模块: from Autodesk.Revit import DB [as 别名]
# 或者: from Autodesk.Revit.DB import ElementId [as 别名]
def NewDS(s1, cat1, name1):
temp_path = System.IO.Path.GetTempPath()
sat_path = "%s%s.sat"% (temp_path, name1)
try:
if factor != 1:
s1 = s1.Scale(factor)
sat1 = Geometry.ExportToSAT(s1, sat_path)
satId = doc.Import(sat1, satOpt, view1)
el1 = doc.GetElement(satId)
geom1 = el1.get_Geometry(opt1)
enum = geom1.GetEnumerator()
enum.MoveNext()
geom2 = enum.Current.GetInstanceGeometry()
enum2 = geom2.GetEnumerator()
enum2.MoveNext()
s1 = enum2.Current
doc.Delete(satId)
System.IO.File.Delete(sat_path)
if cat1 is None or not RVT.DirectShape.IsValidCategoryId(cat1.Id, doc):
cat1Id = RVT.ElementId(RVT.BuiltInCategory.OST_GenericModel)
else:
cat1Id = cat1.Id
if name1 in dst_enum:
old_type = dst_enum[name1]
old_type.SetShape([s1])
fec1 = RVT.FilteredElementCollector(doc).OfClass(RVT.DirectShape).WhereElementIsNotElementType()
insts = [i for i in fec1 if i.GetTypeId().Equals(old_type.Id)]
if insts:
ds1 = insts[0]
else:
dsLib.AddDefinitionType(name1, old_type.Id)
if isRvt2017:
ds1 = RVT.DirectShape.CreateElementInstance(doc, old_type.Id, cat1Id, name1, tf1)
else:
ds1 = RVT.DirectShape.CreateElementInstance(doc, old_type.Id, cat1Id, name1, tf1, "Dynamo", "spring nodes")
ds1.SetTypeId(old_type.Id)
else:
dsType1 = RVT.DirectShapeType.Create(doc, name1, cat1Id)
dsType1.SetShape([s1])
dsLib.AddDefinitionType(name1, dsType1.Id)
dst_enum[name1] = dsType1
if isRvt2017:
ds1 = RVT.DirectShape.CreateElementInstance(doc, dsType1.Id, cat1Id, name1, tf1)
else:
ds1 = RVT.DirectShape.CreateElementInstance(doc, dsType1.Id, cat1Id, name1, tf1, "Dynamo", "spring nodes")
ds1.SetTypeId(dsType1.Id)
return ueWrapper.Invoke(None, (ds1, False) )
except:
return traceback.format_exc()