|
3m
楼主 |
发表于 2010-3-12 13:27:57
|
只看该作者
本帖最后由 panhao1 于 2010-3-12 13:29 编辑
麻烦一点的bake做法
C# 根据自己需求改vb.net
if(obj is IOnBrep){ //If a brep, a polysurface or a surface
addedObj = doc.AddBrepObject((IOnBrep) obj, att);
} else if(obj is IOnMesh) //If a mesh
addedObj = doc.AddMeshObject((IOnMesh) obj, att);
else if(obj is IOnLine) //If a line (not a curve)
addedObj = doc.AddCurveObject(new OnLineCurve((IOnLine) obj), att);
else if(obj is IOnArc) //If an arc (not a curve)
addedObj = doc.AddCurveObject(new OnArcCurve((IOnArc) obj), att);
else if(obj is IOnCircle){ //If a circle (not a curve)
OnNurbsCurve crv = new OnNurbsCurve();
((OnCircle) obj).GetNurbForm(ref crv);
addedObj = doc.AddCurveObject(crv, att);
} else if(obj is IOnCurve) //If a curve
addedObj = doc.AddCurveObject((IOnCurve) obj, att);
else if(obj is IOn3dPoint) //If a point
addedObj = doc.AddPointObject((IOn3dPoint) obj, att);
else if(obj is IArrayOn3dPoint) //If a pointcloud
addedObj = doc.AddPointCloudObject((IArrayOn3dPoint) obj, att);
else if(obj is IOn3dVector) { //If a vector
att.m_object_decoration = IOn.object_decoration.end_arrowhead;
addedObj = doc.AddCurveObject(new OnLineCurve(new OnLine(new On3dPoint(0, 0, 0), (new On3dPoint(0, 0, 0)) + (On3dVector) obj)), att);
} else if(obj is Grasshopper.Kernel.IGH_BakeAwareData){ //If other strange type of geometry, including Box and Twistedbox
Guid gu;
((Grasshopper.Kernel.IGH_BakeAwareData ) obj).BakeGeometry(doc, att, out gu, out addedObj);
} else {//Otherwise dont know what to do...
continue;
} |
|