BlackAlnet 发表于 2022-7-6 12:13:50

Vla put插入点

这是怎么回事?
 
(defun c:asd (/ ent obj x y y2 pos)
(vl-load-com)
(if (setq ent( entsel "\nSelecione: "))
   (progn
   (setq obj (vlax-ename->vla-object (car ent)))
   (setq cord (cdr ent))
   (setq x (car cord))
   (setq y (cdr cord))
   (setq y2 (= y -1))
   (setq pos (vla-get-alignment obj))
   (vla-put-backward obj 1)
   (vla-put-upsidedown obj 1)
   )
   )
(if ( = pos 2)
   (vla-put-alignment obj 12)
   )
(if ( = pos 0)
   (vla-put-alignment obj 14)
   )
(vla-put-insertionpoint obj list(x y2 0))
)
我无法更改文本的插入点。
 
我很高兴在这段代码上得到任何帮助或改进。
 
谢谢

fixo 发表于 2022-7-6 12:29:05

 
查看TextAlignmentPoint属性
在帮助文件中
 
~'J'~

BlackAlnet 发表于 2022-7-6 12:38:36

我读了,但我无法修复那个部分,它继续返回“错误:坏函数:(800194.0 469602.0 0.0)”

alanjt 发表于 2022-7-6 12:42:57

替换为此行:
(vla-put-insertionpoint obj (vlax-3D-point (list x y2 0)))
 
 
[列表=1]
[*]您的列表定义不正确。
[*]您必须将列表转换为变体。
[/列表]

BlackAlnet 发表于 2022-7-6 12:55:26

 
 
alanjt,我试过这个,但它不起作用。。。继续返回
 
“错误:错误的参数类型:numberp:(800059.0 469502.0 0.0)”
 
我不知道发生了什么

fixo 发表于 2022-7-6 12:57:42

 
这里还有很多基本错误:
 
看看它将如何工作(稍微测试一下)
 

(defun c:asd (/ ent obj x y y2 pos)
(vl-load-com)
(if (setq ent( entsel "\nSelecione: "))
   (progn
   (setq obj (vlax-ename->vla-object (car ent)))
   (setq cord (cadr ent));; was (cdr ent)
   (setq x (car cord))
   (setq y (cadr cord));; was (cdr cord)
   (setq y2 (- y 1)) ; was (= y -1); bad syntax
   (setq pos (vla-get-alignment obj))
   (vla-put-backward obj 1)
   (vla-put-upsidedown obj 1)
   )
   )

(cond (( = pos 0)
   (progn   
   (vla-put-insertionpoint obj (vlax-3d-point (list x y2 0)));was (vla-put-insertionpoint obj list(x y2 0))
   (vla-put-alignment obj 12)
   (vla-put-textalignmentpoint obj (vlax-3d-point (list x y2 0)));;added
   )
   )
(( = pos 2)
   (progn
   (vla-put-insertionpoint obj (vlax-3d-point (list x y2 0)));was (vla-put-insertionpoint obj list(x y2 0))
   (vla-put-alignment obj 14)
   (vla-put-textalignmentpoint obj (vlax-3d-point (list x y2 0)));;added
)
)
())
(princ)
)

 
~'J'~

BlackAlnet 发表于 2022-7-6 13:06:40

明白了,非常感谢!!
 
我没有意识到我需要更改引导对齐和插入点。
 
非常感谢fixo。

fixo 发表于 2022-7-6 13:15:39

 
不客气,
干杯
 
~'J'~
页: [1]
查看完整版本: Vla put插入点