convert to survey points

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear Members,
Help me out with this one:
I am extracting four corners of a rectangular column with the following code:
ProjectPosition projectPosition = Command.activeDoc.ActiveProjectLocation.get_ProjectPosition(XYZ.Zero);
XYZ translationVector = new XYZ(projectPosition.EastWest, projectPosition.NorthSouth, projectPosition.Elevation);
Transform translationTransform = Transform.get_Translation(translationVector);
Transform rotationTransform = Transform.get_Rotation(XYZ.Zero, XYZ.BasisZ, projectPosition.Angle);
Transform finalTransform = translationTransform.Multiply(rotationTransform);
double xul = 0;
double yul = 0;
double xur = 0;
double yur = 0;
double xll = 0;
double yll = 0;
double xlr = 0;
double ylr = 0;
LocationPoint lp = fi.Location as LocationPoint;
XYZ gotpoint1 = finalTransform.OfPoint(lp.Point);
XYZ gotpoint = new XYZ(lp.Point.X * 304.8, lp.Point.Y * 304.8, 0);
FamilySymbol FmlySmbl = fi.Symbol;
Family Fmly = FmlySmbl.Family;
Document familyDoc = Command.activeDoc.EditFamily(Fmly);
FamilyManager familyManager = familyDoc.FamilyManager;
FamilyParameter familyParamb = familyManager.get_Parameter("b");
FamilyParameter familyParamh = familyManager.get_Parameter("h");
FamilyType type = familyManager.CurrentType;
double b = type.AsDouble(familyParamb).Value * 304.8;
double h = type.AsDouble(familyParamh).Value * 304.8;
double halfb = 0;
double halfh = 0;
halfb = b / 2;
halfh = h / 2;
double angle = Math.Round(lp.Rotation * 180 / Math.PI, 0);
xul = gotpoint.X + (halfb) * Math.Cos(angle * Math.PI / 180) - (halfh) * Math.Sin(angle * Math.PI / 180);
yul = gotpoint.Y + (halfh) * Math.Cos(angle * Math.PI / 180) + (halfb) * Math.Sin(angle * Math.PI / 180);
XYZ trfxul = finalTransform.OfPoint(new XYZ(xul ,yul ,0));
xul = trfxul.X;
yul = trfxul.Y;
xur = gotpoint.X - (halfb) * Math.Cos(angle * Math.PI / 180) - (halfh) * Math.Sin(angle * Math.PI / 180);
yur = gotpoint.Y + (halfh) * Math.Cos(angle * Math.PI / 180) - (halfb) * Math.Sin(angle * Math.PI / 180);
trfxul = finalTransform.OfPoint(new XYZ(xur, yur, 0));
xur = trfxul.X;
yur = trfxul.Y;
xll = gotpoint.X + (halfb) * Math.Cos(angle * Math.PI / 180) + (halfh) * Math.Sin(angle * Math.PI / 180);
yll = gotpoint.Y - (halfh) * Math.Cos(angle * Math.PI / 180) + (halfb) * Math.Sin(angle * Math.PI / 180);
trfxul = finalTransform.OfPoint(new XYZ(xll, yll, 0));
xll = trfxul.X;
yll = trfxul.Y;
xlr = gotpoint.X - (halfb) * Math.Cos(angle * Math.PI / 180) + (halfh) * Math.Sin(angle * Math.PI / 180);
ylr = gotpoint.Y - (halfh) * Math.Cos(angle * Math.PI / 180) - (halfb) * Math.Sin(angle * Math.PI / 180);
trfxul = finalTransform.OfPoint(new XYZ(xlr, ylr, 0));
xlr = trfxul.X;
ylr = trfxul.Y;
The above code works perfectly in one project but not in other. The project in which it works perfectly has the following properties as shown in the below image followed by the image showing the properties of the project in which it doesn;t work The only difference between the two that I noticed is that in the first both project point and survey points are same whereas in the second one there is a difference between project point and survey point.
first image
second image
Thanks & Regards