从点列表构造变体 
到目前为止,polypoints 变量中的数据采用列表格式,适用于许多 AutoLISP 调用。但是,数据将作为输入参数提供给需要 ActiveX 变体数组的 ActiveX 调用。您可以使用另一个实用程序函数进行从列表到变体的所需转换: (defun gp:list->variantArray (ptsList / arraySpace sArray)
  ; allocate space for an array of 2d points stored as doubles
  (setq arraySpace (vlax-make-safearray
              vlax-vbdouble ; element type
              (cons 0
                    (- (length ptsList) 1)
                    ) ; array dimension
              )
  )
  (setq sArray (vlax-safearray-fill arraySpace ptsList))
  ; return array variant
  (vlax-make-variant sArray)
)
以下操作发生在:gp:list->variantArray 
 下面是一个函数调用的示例,该调用调用用于将列表转换为 double 的变体数组:gp:list->variantArray ; data conversion from list to variant (setq VLADataPts (gp:list->variantArray polypoints))  | 
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
GMT+8, 2025-11-4 15:08
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.