xTNickx 发表于 2022-7-6 10:24:43

MrSid图像大小

你好
 
首先是一点背景知识。我有一些大量的MrSid(sid文件)和相应的sdw文件来告诉我们应该在哪里以及如何插入图像的信息。该文件如下所示:
 
我想要构建的是一个“数据库”,可以通过lisp例程进行搜索。工作流程如下:
命令:Src\u img
请选择一个点:
要插入>
 
现在,虽然此列表中的所有内容都很琐碎,但我似乎很难检索Autocad环境中出现的外来文件类型的大小(如sid)(如果您愿意,请使用wold大小)。对于其他文件,我使用了在web上找到的技巧(VBA):
 
Set objFolder = obj_Shell.Namespace(FilePth)
Set objFile = objFolder.ParseName(FileName)
objFile.ExtendedProperty("Dimensions")
 
这给了我们以像素为单位的大小。有了前面介绍的比例,计算右下角的坐标也很简单。
 
现在的问题是:
您知道使用lisp或vba获取sid图像大小(像素或世界大小)的方法吗?我甚至可以递归地搜索文件夹中的sid文件,加载它们,检索右下角,卸载,然后一步一步地执行。
 
顺便说一句,我已经从LizardTech下载了sdk,我会看看能从那里得到什么。
 
非常感谢您的真知灼见!
祝你有美好的一天!
刻痕
 
PS我给了你们很多信息,只是为了避免阅读我已经知道的东西。很抱歉

xTNickx 发表于 2022-7-6 11:31:20

我只是来这里获取一些ObjectARX信息,我记得没有答案。我这样做了(在Autocad Land Desktop 2007上):
 
-excel工作表(代码中由EXCSheet引用),其中包含第1列中所有图像的完整路径和名称
-FILEDIA设置为0
 

   With EXCSheet
       i = 4
       Do
RetryIns:
         ThisDrawing.SendCommand ("MAPIINSERT" & vbCrLf)
         ThisDrawing.SendCommand ("""" & .Cells(i, 1).Value & """" & vbCrLf)
         DoEvents
         Sleep 2000 ' maybe less
         ThisDrawing.SendCommand ("N" & vbCrLf) ' answer no

         ' this is he only image in the drawing (empty drawing)
         For Each a In ThisDrawing.ModelSpace
               If (TypeOf a Is AcadRasterImage) Then
                   Set the_img = a
                   insp = the_img.Origin ' insertion may fail to place image
                   If (insp(0) = 0) And (insp(1) = 0) Then
                     the_img.Delete ' if so, we should retry
                     GoTo RetryIns
                   End If
                  
                  
                   Call the_img.GetBoundingBox(minp, maxp)
                   ' you may save bounding box here
                   scl_ty = ThisDrawing.GetVariable("INSUNITS")
                   Call ThisDrawing.SetVariable("INSUNITS", 0)                  
                   ' save here the_img.Rotation and the_img.ScaleFactor
                   Call ThisDrawing.SetVariable("INSUNITS", scl_ty)
                   ' maybe you need maximum/ minimum values... this is the place
                   the_img.Delete ' no need for this image any more
                   Exit For
               End If
         Next a
         
         i = i + 1
       Loop Until .Cells(i, 1).Value = ""
   End With
   
 
代码可能看起来很奇怪,因为将值保存到excel表的部分被剥离了,但这只是一般的想法。
 
顺致敬意,
刻痕
页: [1]
查看完整版本: MrSid图像大小