在 Windows Server 上使用 Eyeshot 2021 时出现 ZoomFit 错误
下午好, 我正在尝试在 .NET Framework Web 应用程序中使用 Eyeshot 创建位图图像。我的代码中的过程步骤如下:生成所有必需的实体,然后将它们添加到 Web 应用程序中不可见的模型控件中;添加所有实体后,我使用 ZoomFit() 方法缩放到所需的实体,然后使用 RenderToBitmap() 方法创建位图图像。 该问题与 ZoomFit() 方法有关:执行时,会给出以下错误消息: “必须首先创建控件的句柄”。 有关创建模型控件的代码部分如下:
Model model1 = new Model();
model1.InitializeViewports();
model1.Size = new Size(500, 300);
model1.CreateControl();
model1.Layers.Add("Grid");
model1.Layers["Grid"].LineWeight = 0.3f;
model1.Layers["Grid"].Color = Color.LightGray;
model1.Layers.Add("Gauges");
model1.Layers["Gauges"].LineWeight = 1.5f;
// List of entities for correct zooming
IList<Entity> Grid = new List<Entity>();
IList<Entity> Gauges = new List<Entity>();
// List of strings containing the paths to the dxf files on the server
List<string> drawingsFilePaths = (List<string>)Session["drawingsFilePaths"];
// List of images
List<Bitmap> drawings = new List<Bitmap>();
foreach (string path in drawingsFilePaths)
{
// Clearing the entities every time I change the file
model1.Entities.Clear();
// Creating the viewport starting from the dxf files
ReadAutodesk read = new ReadAutodesk(path);
read.DoWork();
foreach (Entity en in read.Entities)
{
if (en.LayerName == "Grid")
{
Grid.Add(en);
}
else if (en.LayerName == "Gauges")
{
Gauges.Add(en);
}
model1.Entities.Add(en);
}
model1.ActiveViewport.OriginSymbol.Visible = false;
model1.ActiveViewport.ViewCubeIcon.Visible = false;
model1.ActiveViewport.ToolBar.Visible = false;
model1.ActiveViewport.SetView(viewType.Right);
model1.ZoomFit(Gauges, false);
Bitmap tmp = model1.RenderToBitmap(1);
drawings.Add(tmp);
但是,仅当在远程服务器 (Windows Server 2012) 上发布 Web 应用程序时才会遇到此问题;事实上,当我使用自己的个人计算机(Windows 10)作为服务器发布它时,一切都运行良好。 我已经检查了已发布的Web应用程序中是否存在所有Eyeshot DLL,并且我的PC和服务器上的IIS设置是相同的。这可能是与 Eyeshot DLL 隐式调用且 Windows Server 上不存在的一些缺失引用相关的问题吗?您认为问题出在哪里?
亲切的问候,
贾科莫·巴莱斯特里里
Good afternoon,
I am trying to use Eyeshot in a .NET Framework Web Application to create a Bitmap image. The steps of the process in my code are the following: I generate all the necessary Entities and then I add them to a Model control that is not visible in the Web Application; once all Entities are added, I use the ZoomFit() method to zoom to the desired Entities and then I use the RenderToBitmap() method to create the Bitmap image.
The issue regards the ZoomFit() method: when executed, it gives the following error message:
"Control's handle must be created first".
The portion of code regarding the creation of the Model control is the following:
Model model1 = new Model();
model1.InitializeViewports();
model1.Size = new Size(500, 300);
model1.CreateControl();
model1.Layers.Add("Grid");
model1.Layers["Grid"].LineWeight = 0.3f;
model1.Layers["Grid"].Color = Color.LightGray;
model1.Layers.Add("Gauges");
model1.Layers["Gauges"].LineWeight = 1.5f;
// List of entities for correct zooming
IList<Entity> Grid = new List<Entity>();
IList<Entity> Gauges = new List<Entity>();
// List of strings containing the paths to the dxf files on the server
List<string> drawingsFilePaths = (List<string>)Session["drawingsFilePaths"];
// List of images
List<Bitmap> drawings = new List<Bitmap>();
foreach (string path in drawingsFilePaths)
{
// Clearing the entities every time I change the file
model1.Entities.Clear();
// Creating the viewport starting from the dxf files
ReadAutodesk read = new ReadAutodesk(path);
read.DoWork();
foreach (Entity en in read.Entities)
{
if (en.LayerName == "Grid")
{
Grid.Add(en);
}
else if (en.LayerName == "Gauges")
{
Gauges.Add(en);
}
model1.Entities.Add(en);
}
model1.ActiveViewport.OriginSymbol.Visible = false;
model1.ActiveViewport.ViewCubeIcon.Visible = false;
model1.ActiveViewport.ToolBar.Visible = false;
model1.ActiveViewport.SetView(viewType.Right);
model1.ZoomFit(Gauges, false);
Bitmap tmp = model1.RenderToBitmap(1);
drawings.Add(tmp);
However, this issue is faced ONLY when publishing the Web Application on a remote Server (Windows Server 2012); in fact, when I publish it using my own personal computer (Windows 10) as a server, everything works perfectly.
I already checked the presence of all the Eyeshot DLLs in the pubblished Web Application, and the settings of IIS on my PC and on the Server are the same. Could it be an issue related to some missing references that are implicitly called by Eyeshot DLLs and are not present on Windows Server? What do you think is the problem?
Kind regards,
Giacomo Balestrieri
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个许可问题。 Eyeshot试用版无法复制到其他机器上。如果您将应用程序复制到另一台 Win10 计算机上,也会出现同样的问题。
This is a licensing issue. Eyeshot Trial version cannot be copied on other machines. The same problem would occur if you copy your app to a different Win10 machine.