DatumPlane SetCurve problems

DatumPlane SetCurve problems

bosborne
Advocate Advocate
1,306 Views
3 Replies
Message 1 of 4

DatumPlane SetCurve problems

bosborne
Advocate
Advocate
I am trying to use DatumPlane.SetCurveInView to duplicate 2d extents of grids across views. I am taking a reference view and using GetCurvesInView to get the curve to set with. This works fine for views that are essentially copies of the primary view (Same Associated Level)

But when I attempt it for plan views that are at a different level than the reference plan view, it does not work. Which makes sense....the ref curve is not at the correct elevation.

No problem, I'll use Curve.CreateTransformed(Transform.CreateTranslation(XYZ(0,0,offset))) where offset is the Z value (level elevation) of my new view minus the Z value of the reference level. But this fails for some reason. The error states that the curve must be bound and coincident with the datum plane. I tested using Curve.IsBound and that returned "True"....so how can the curve not be coincident if it was only offset in Z??

I also tried getting the start and end points of the reference curve, and creating new XYZ with the new Z value and using Line.CreateBound but that too gave me the same error.

So my question is - how do I use SetCurveInView when the reference curve is taken from a datum plane that is in a plan view at a different elevation than the plan view containing the datum plane I am trying to set.
1,307 Views
3 Replies
Replies (3)
Message 2 of 4

Aaron.Lu
Autodesk
Autodesk
Dear bosborne, is it possible to provide a rvt file with code example to help us to reproduce your problem? thanks


Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 3 of 4

simonjones-uk
Contributor
Contributor

Did you ever solve this? I'm experiencing the same problem attempting to resize the DatumPlane associated with Levels

Message 4 of 4

admaecc211151
Advocate
Advocate
foreach (Curve cv in dp.GetCurvesInView(DatumExtentType.Model, doc.ActiveView))
{
    MessageBox.Show(cv.GetEndPoint(0).ToString() + "  " + cv.GetEndPoint(1).ToString());
}

I use this parse to read the curves, and found that it's only works in view section, and the curve is bounded by both the Z-axis and the section plane.

So edit it in South Side and East Side View (or any sections horizontal to X and Y axis) would be better.

Level level;
View southViewSection, eastViewSection;

//get these and check the view is with correct direction.

//edit the datum for X-axis
Curve datumToCurveX = level.GetCurvesInView(DatumExtentType.Model, southViewSection).First();
                datumToCurveX = Line.CreateBound(
                    new XYZ(newX0, datumToCurveX.GetEndPoint(0).Y, datumToCurveX.GetEndPoint(0).Z),
                    new XYZ(newX1, datumToCurveX.GetEndPoint(1).Y, datumToCurveX.GetEndPoint(1).Z)
                );
                level.SetCurveInView(DatumExtentType.Model, southViewSection, datumToCurveX);
//do Same for Y-axis

 

0 Likes