Hi all,
I am trying to load a 3dm file into 3js and having an issue displaying extrusions. The extrusions are there in the 3dm but don’t get displayed in the 3js.
This is the error in console:
This is the 3js
This is the code I use to create these extrusions
for feature in building_layerMB['features']:
geometry_type = feature['geometry']['type']
height = feature['properties']['height']
if geometry_type == 'Polygon':
geometry = feature['geometry']['coordinates']
for ring in geometry:
points = []
for coord in ring:
x_val, y_val = coord[0], coord[1]
x_prop = (x_val / 4096)
y_prop = (y_val / 4096)
lon_delta = lon2 - lon1
lat_delta = lat2 - lat1
lon_mapped = lon1 + \
(x_prop * lon_delta)
lat_mapped = lat1 + \
(y_prop * lat_delta)
lon_mapped, lat_mapped = transformer.transform(
lon_mapped, lat_mapped)
point = rh.Point3d(
lon_mapped, lat_mapped, 0)
points.append(point)
polyline = rh.Polyline(points)
curve = polyline.ToNurbsCurve()
orientation = curve.ClosedCurveOrientation()
if str(orientation) == 'CurveOrientation.Clockwise':
curve.Reverse()
att_bf = rh.ObjectAttributes()
att_bf.LayerIndex = buildingfootprint_LayerIndex
model.Objects.AddCurve(curve, att_bf)
extrusion = rh.Extrusion.Create(
curve, height, True)
att = rh.ObjectAttributes()
att.LayerIndex = building_layerIndex
att.SetUserString(
"Building Height", str(height))
model.Objects.AddExtrusion(
extrusion, att)
buildings.append(extrusion)
Do I need to fix my python code to generate the extrusions or is there something I need to do in JS code itself?
Thanks