Hello,
I’m new to c# and I’ve been following a long tutorial and I’ve hit a bit of a dead end. I can’t figure out why my script isn’t colouring the blocks correctly. The ObjectAttributes and ObjectColorSource aren’t appearing correctly in Visual Studio - what am I missing?
System.Drawing.Color bldCol = System.Drawing.Color.White;
if (actBuildingHeight < 6)
bldCol = System.Drawing.Color.FromArgb(168, 126, 198);
else if (actBuildingHeight < 12)
bldCol = System.Drawing.Color.FromArgb(255, 173, 194);
else if (actBuildingHeight < 36)
bldCol = System.Drawing.Color.FromArgb(243, 104, 75);
else if (actBuildingHeight < 92)
bldCol = System.Drawing.Color.FromArgb(225, 164, 24);
else if (actBuildingHeight > 92)
bldCol = System.Drawing.Color.FromArgb(254, 255, 51);
**ObjectAttributes** oa = new **ObjectAttributes**();
oa.ColorSource = **ObjectColorSource**.ColorFromObject;
oa.ObjectColor = bldCol;
Curve border = Curve.JoinCurves(this.plotSrf.DuplicateNakedEdgeCurves(true, false))[0];
this.buildingOutline = Curve.JoinCurves(border.Offset(Plane.WorldXY, -4, RhinoDoc.ActiveDoc.ModelAbsoluteTolerance, CurveOffsetCornerStyle.None))[0]; //dimension for building offset from plot border is list as 2
this.building = Extrusion.Create(this.buildingOutline, actBuildingHeight, true);
RhinoDoc.ActiveDoc.Objects.AddCurve(buildingOutline);
RhinoDoc.ActiveDoc.Objects.AddExtrusion(this.building);
Thanks,
Iain