} // End Function GetApertureWebService public static ApertureBounds GetBounds(string d, string projname) { ApertureCrap.ApScriptingService ass = GetApertureWebService(); string cmdname = "DrawingBounds"; string parameters = "<DrawingName>" + d + "</DrawingName>"; string strBounds = ass.ExecuteCommand(cmdname, projname, parameters); return(new ApertureBounds(strBounds)); } // End Function GetBounds
} // End Function GetFitFactor // Nur mit IE // https://www6.cor-asp.ch/FM_COR_Demo/test/DWG.html public static string ClickDrawing(string d, string projname, ApertureBounds b) { string l = "RaumNutzung"; // Layerset double w = 800; // Bildgrösse double h = 600; // Bildgrösse double x = 336; // Click-Position double y = 292; // Click-Position x = 625; y = 182; // SVG w = 2098; // Bildgrösse h = 2969; // Bildgrösse w = 790; h = 1121; x = 190; y = 490; //double mx = w / 2.0; //double my = h / 2.0; //x = mx - x; //y = my - y; //double s = GetFitFactor(2098, 2969, 800, 600); //double sx = 800.0 / w; //double sy = 600.0 / h; //x = x * sx; //y = y * sy; //w = 800; //h = 600; ApertureCrap.ApScriptingService ass = GetApertureWebService(); // string mImageLinkTemplate = "{@domain}/ApWebServices/ApDrawingImages.aspx?p={@project}&d={@dwg}&xlr={@r}&ylr={@b}&yul={@t}&xul={@l}&dx={@width}&dy={@height}&L={@layerset}&S={@stylizer}&SEL={@obj}&F=PNG&uu={@cache}"; string mParamClickTemplate = "<InParams><Drawing>{@dwg}</Drawing><l>{@l}</l><r>{@r}</r><t>{@t}</t><b>{@b}</b><Width>{@width}</Width><Height>{@height}</Height><ClickX>{@x}</ClickX><ClickY>{@y}</ClickY><LayerSet>{@layerset}</LayerSet><RecTypes>0</RecTypes></InParams>"; string parameters = mParamClickTemplate; parameters = parameters .Replace("{@dwg}", d) .Replace("{@r}", b.sR.Replace(",", ".")) #if true // interchange b & t because Aperture is buggy... .Replace("{@b}", b.sT.Replace(",", ".")) .Replace("{@t}", b.sB.Replace(",", ".")) #else .Replace("{@b}", b.sB.Replace(",", ".")) .Replace("{@t}", b.sT.Replace(",", ".")) #endif .Replace("{@l}", b.sL.Replace(",", ".")) .Replace("{@width}", ToAwsString(w)) .Replace("{@height}", ToAwsString(h)) .Replace("{@layerset}", l) .Replace("{@y}", ToAwsString(y)) .Replace("{@x}", ToAwsString(x)) // .Replace("<", "<") // .Replace(">", ">") ; string cmdname = "_DrawingClick"; string strRes = ass.ExecuteCommand(cmdname, projname, parameters); System.Console.WriteLine(strRes); System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.LoadXml(strRes); System.Xml.XmlNode nd = doc.SelectSingleNode("//ObjectID"); System.Console.WriteLine(nd); string strApertureObjId = null; if (nd != null) { strApertureObjId = nd.InnerText; } return(strApertureObjId); } // End Function ClickDrawing