Hi all,
I am trying to extrude the curve from block i have few blocks and those are copied in various places for several time, I am trying to extrude the outer curves of the blocks, However it is getting always extruded at the World Origin (0,0,0).
It shall get extruded at its present location.
please let me what I am doing wrong.
here is the I wrote
List blockNames = new List() {“BA_IM_01”, “BB_ST_01”, “BB_ST_02”, “BA_IM_02”, “BA_ST_01”, “BA_CO_04” };
List thickness = new List() { 10.0, 12.0, 12.0, 15.0, 20.0, 25.0 };
for (int i = 0; i < blockNames.Count; i++)
{
InstanceDefinition def = doc.InstanceDefinitions.Find(blockNames[i]);
double height = thickness[i];
if (def == null)
{
RhinoApp.WriteLine("Block \"{0}\" not found", blockNames[i]);
continue;
}
else
{
InstanceObject[] obj = def.GetReferences(0);
int objCount = obj.Length;
foreach (InstanceObject instO in obj)
{
InstanceDefinition newDef = instO.InstanceDefinition;
List<RhinoObject> nObj = newDef.GetObjects().ToList();
List<Curve> curves = new List<Curve>();
nObj.ForEach(o => curves.Add(o.Geometry as Curve));
curves = curves.OrderByDescending(c => c.GetLength()).ToList();
Curve curveToExtrude = curves[0];
doc.Objects.AddExtrusion(Extrusion.Create(curveToExtrude, height, true));
}
}
}
doc.Views.Redraw();
return Result.Success;
image 1_Extrusion at origin
image 2_No extrusion at the location blocks