本文整理匯總了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()