public bool GetActivePageExtent(out float fMaxExtentX, out float fMaxExtentY, out float fScale, out bool bNoUnit) { Visio.Page visPage; double dblMaxExtentX, dblMaxExtentY, dblDrawingScale, dblScale; int iDrawingScaleType; double dblRulerOriginX, dblRulerOriginY; fMaxExtentX = 0.0f; fMaxExtentY = 0.0f; fScale = 1.0f; visPage = visApplication.ActivePage; VisualShow3DLightUtil.GetDoubleCellVal(visPage, "XRulerOrigin", (int)Visio.VisUnitCodes.visNumber, out dblRulerOriginX); VisualShow3DLightUtil.GetDoubleCellVal(visPage, "YRulerOrigin", (int)Visio.VisUnitCodes.visNumber, out dblRulerOriginY); VisualShow3DLightUtil.GetDoubleCellVal(visPage, "PageWidth", (int)Visio.VisUnitCodes.visNumber, out dblMaxExtentX); VisualShow3DLightUtil.GetDoubleCellVal(visPage, "PageHeight", (int)Visio.VisUnitCodes.visNumber, out dblMaxExtentY); fMaxExtentX = (float)(dblMaxExtentX); fMaxExtentY = (float)(dblMaxExtentY); VisualShow3DLightUtil.GetIntCellVal(visPage, "DrawingScaleType", out iDrawingScaleType); bNoUnit = (iDrawingScaleType == 0) ? true : false; VisualShow3DLightUtil.GetDoubleCellVal(visPage, "DrawingScale", (int)Visio.VisUnitCodes.visNumber, out dblDrawingScale); VisualShow3DLightUtil.GetDoubleCellVal(visPage, "PageScale", (int)Visio.VisUnitCodes.visNumber, out dblScale); fScale = (float)(dblScale / dblDrawingScale) * fScaleViewFactor; return(true); }
public void CreateVisio3DObjectFromBoundingBox(Visio.Shape visCurShape, out Visio3DObject visio3DObject) { PointF ptCurOrigin; double dblCurOrigX, dblCurOrigY, dblCurAngle, dblCurWidth, dblCurHeight, dblCurThickness, dblCurElevation; double dblCurLocPinX, dblCurLocPinY; float fCurAngle, fCurLength, fCurHeight, fCurThickness, fCurElevation; string strCurMaterial = "", strBoxTextureFileName = null, strFrontTextureFileName = null; Color elementColor = Color.White; VisualShow3DLightUtil.GetDoubleCellVal(visCurShape, "PinX", (int)Visio.VisUnitCodes.visNumber, out dblCurOrigX); VisualShow3DLightUtil.GetDoubleCellVal(visCurShape, "PinY", (int)Visio.VisUnitCodes.visNumber, out dblCurOrigY); VisualShow3DLightUtil.GetDoubleCellVal(visCurShape, "LocPinX", (int)Visio.VisUnitCodes.visNumber, out dblCurLocPinX); VisualShow3DLightUtil.GetDoubleCellVal(visCurShape, "LocPinY", (int)Visio.VisUnitCodes.visNumber, out dblCurLocPinY); VisualShow3DLightUtil.GetDoubleCellVal(visCurShape, "Angle", (int)Visio.VisUnitCodes.visDegrees, out dblCurAngle); VisualShow3DLightUtil.GetDoubleCellVal(visCurShape, "Width", (int)Visio.VisUnitCodes.visNumber, out dblCurWidth); VisualShow3DLightUtil.GetDoubleCellVal(visCurShape, "Height", (int)Visio.VisUnitCodes.visNumber, out dblCurThickness); try { VisualShow3DLightUtil.GetDoubleCellVal(visCurShape, "Prop.VS3DHeight", (int)Visio.VisUnitCodes.visNumber, out dblCurHeight); } catch { dblCurHeight = 0.0; } try { VisualShow3DLightUtil.GetDoubleCellVal(visCurShape, "Prop.VS3DElevation", (int)Visio.VisUnitCodes.visNumber, out dblCurElevation); } catch { dblCurElevation = 0.0; } try { VisualShow3DLightUtil.GetStringCellProp(visCurShape, "Prop.VS3DMaterial", out strBoxTextureFileName); } catch { strCurMaterial = ""; } if (strCurMaterial == "") { VisualShow3DLightUtil.GetRGBCellVal(visCurShape, "FillForegnd", out strCurMaterial); VisualShow3DLightUtil.GetColor(strCurMaterial, out elementColor); } ptCurOrigin = new PointF((float)dblCurOrigX, (float)dblCurOrigY); fCurAngle = (float)dblCurAngle; fCurLength = (float)dblCurWidth; fCurHeight = (float)dblCurHeight; if (VisualShow3DLightUtil.IsOneD(visCurShape)) { fCurThickness = 0.0f; } else { fCurThickness = (float)dblCurThickness; } fCurElevation = (float)dblCurElevation; visio3DObject = new Visio3DObject(ptCurOrigin, fCurAngle, fCurLength, fCurHeight, fCurThickness, fCurElevation, elementColor, Color.White, strBoxTextureFileName, strFrontTextureFileName); }