0

下午好,我正在尝试在 .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 上不存在的一些缺失引用相关的问题吗?你认为是什么问题?

亲切的问候,

贾科莫·巴莱斯特里里

4

1 回答 1

0

这是一个许可问题。Eyeshot 试用版无法复制到其他机器上。如果您将应用程序复制到不同的 Win10 机器,也会出现同样的问题。

于 2022-03-01T11:56:03.877 回答