Hi all,
I am developing a dynamo script to make an opening in a rebar set, the main issue I am facing is that I cannot read each rebar in the rebar set.
any suggestions ?
thank you
Hi all,
I am developing a dynamo script to make an opening in a rebar set, the main issue I am facing is that I cannot read each rebar in the rebar set.
any suggestions ?
thank you
There is no way anybody would be able to figure out your problem with the information provided.
Please provide complete screenshots with list previews and error messages expanded. Thanks
hi @Kulkul thanks for replying
there is no warnings till now, the problem is that I can not read the rebar set to change it to model lines.
For a single bar I am using the node (RebarGetCenterlineCurve ) from the Struct4BIM package, but for the rebar set I cannot do that it is only reading the first bar and changing it to a curve.
Try changing Lacing to “Longest” if you have list.
selecting the rebar set is reflecting only one element (ID number of the rebar set ) if I can get the rebars in a list my problem will be solved
@ali.safiaddine It would be better if you can drop dummy rvt file here?
@Kulkul This is the file
TEST REBAR SET.rvt (1.3 MB)
any suggestion guys?
Try this custom node: It will return all bars in the set. You will not get the cruves but the solid bars
Rebar.GetFullGeometryForView.dyf (3.3 KB)
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
element = UnwrapElement(IN[0])
view = UnwrapElement(IN[1])
OUT = [e.ToProtoType(True) for e in element.GetFullGeometryForView(view)]
@ali.safiaddine
You can try with get_Geometry(opt) in stead:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
rebar = UnwrapElement(IN[0])
view = UnwrapElement(IN[1])
opt = Options()
opt.View = view
opt.IncludeNonVisibleObjects = True
geomEl = rebar.get_Geometry(opt)
OUT=[]
for geomObj in geomEl:
if geomObj.ToString() != 'Autodesk.Revit.DB.Solid':
OUT.append(geomObj.ToProtoType())
WOW that’s really amazing thank you but if i want only the rebar centreline what can i do?
sorry for that but am not familiar with python
@ali.safiaddine The solution provided by @Einar_Raknes is exactly what you looking for (rebar centerline). It gives you centerlines of rebars.
Hi @Kulkul
yes i just realized that it gives lines according to the geometry seen in the view, so if the detail level of the view is fine then it will reflect the whole geometry of the rebar.
but also when i change the detail level to coarse am getting multiple lines on each rebar centreline in the image below i have a rebar set of 10 rebars and am getting 34 lines
@ali.safiaddine You need to hit “Ctrl+B” and then “Zoom To Fit”
It depends on which type your active view is. If it is a 3D view the above code should work. You can try to change this to false in a section view with detail level set to coarse:
opt.IncludeNonVisibleObjects = False
(I don’t know if it will work or not)
Thank @Einar_Raknes that’s what I really want I change it to True in the python code and it works perfectly
thank you and sorry for later reply
@ali.safiaddine Check this post, I think that it is a better solution:
@Einar_Raknes I’ll check that thank you