Hi, kinds!
I wanna make a function for creating Extrusion easily like that:
Extrusion createExtrusionZ(CurveArrArray pProfile, double bottom, double height)
{
// mm to feet
double bottomF = mmToFeet(bottom);
double heightF = mmToFeet(height);
// create Sketch Plane
Plane pPlane = Plane.CreateByNormalAndOrigin(new XYZ(0.0,0.0,1.0),new XYZ(0.0,0.0,bottomF));
SketchPlane pSketchPlane = SketchPlane.Create(_rvtDoc, pPlane) as SketchPlane;
// return new Extrusion
bool bIsSolid = true;
return _rvtDoc.FamilyCreate.NewExtrusion(bIsSolid, pProfile, pSketchPlane, heightF);
}
I expect that extrusion from [bottom] to [bottom + height] at Z direction, but I get that from [0] to [height] always.
I suspect that the way to create SketchPlane is mistaken, but I don't have any certain idea.
Could you give me a hand, gentles?
Solved! Go to Solution.
Solved by RPTHOMAS108. Go to Solution.
Thank you, Sir.
I could understand the specification of NewExtrusion-function.
But I wanna make a function as I posted. Therefore I did like below:
Extrusion createExtrusionZ(CurveArrArray pProfile, double bottom, double height)
{
// mmToFeet
double bottomF = mmToFeet(bottom);
double heightF = mmToFeet(height);
// make sketch plane
Plane pPlane = Plane.CreateByNormalAndOrigin(new XYZ(0.0,0.0,1.0),new XYZ(0.0,0.0,0.0));
SketchPlane pSketchPlane = SketchPlane.Create(_rvtDoc, pPlane) as SketchPlane;
// make Extrusion
bool bIsSolid = true;
Extrusion newExtrusion = _rvtDoc.FamilyCreate.NewExtrusion(bIsSolid, pProfile, pSketchPlane, heightF);
// move Extrusion
XYZ transPoint = new XYZ(0.0, 0.0, bottomF);
ElementTransformUtils.MoveElement(_rvtDoc, newExtrusion.Id, transPoint);
return newExtrusion;
}
Step 1 : Make new Extrusion attached to Z=0
Step 2 : Move the Extrusion to expected Z
🧐
Intuitively it would seem that the plane would set the z value as you had it but apparently not.
I don't know if there is a better option than moving the item after creation to enable you to have the same form of function. Curves in the profile can be iterated and transformed to new Z but I don't know if that would be advantageous or not.
Can't find what you're looking for? Ask the community or share your knowledge.