明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 895|回复: 11

[提问] 文字原位黏贴应该怎么写?

[复制链接]
发表于 2022-9-7 16:07 | 显示全部楼层 |阅读模式
1明经币
    想实现文字阴影的效果,现在文字移动了,但是原来的文字要黏贴到原坐标才行,要怎么写?
  1. (defun c:wzyy ()
  2. (setq ssg (ssget '((0 . "*TEXT"))));移动文字


  3. (sssetfirst nil ssg )

  4. (command "MOVE" ssg "" "D"  "0.1,0,0");"0.1,0,0"


  5. (princ)
  6. )



附件: 您需要 登录 才可以下载或查看,没有账号?注册
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2022-9-7 16:07 | 显示全部楼层
spp_wall 发表于 2022-9-8 09:50
效果很好 可惜没有函数 模仿院长写的 但是第一次运行只复制 第二次就执行偏移 第三次才执行改颜色,是什 ...

  1. (defun c:tt ()
  2.   "模拟文本阴影"
  3.   (if (setq ss (ssget '((0 . "*TEXT"))))
  4.     (progn
  5.       (command "undo" "be")
  6.       (setvar "osmode" 0)
  7.       (setq i -1)
  8.       (while (setq s1 (ssname ss (setq i (1+ i))))
  9.         (command "copy" s1 "" '(0 0) '(0 0))
  10.         (setq s2 (entlast))
  11.         (command "MOVE" s2 "" '(0 0) '(-5 5))
  12.         (command "chprop" s2 "" "c" "2" "")
  13.         (command "chprop" s1 "" "c" "1" "")
  14.       )
  15.       (command "regen")
  16.       (command "undo" "e")
  17.     )
  18.   )
  19.   (princ)
  20. )
回复

使用道具 举报

发表于 2022-9-7 17:44 | 显示全部楼层
原位复制一个再移动
回复

使用道具 举报

 楼主| 发表于 2022-9-7 18:18 | 显示全部楼层
(defun c:wzyy ()
(setq ssg (ssget '((0 . "*TEXT"))));移动文字


(setq ssg2
(command "copy" ssg  "" "d" "0, 0, 0" "" ))

(sssetfirst nil ssg2 )

(command "MOVE" ssg2 "" "D"  "0.1,0,0");"0.1,0,0"
(command "change" ssg2 "" "p" "c" "2" "")

(princ)
)
好像可以,但是后面偏移后颜色改成黄色好像不行!
回复

使用道具 举报

发表于 2022-9-7 19:31 | 显示全部楼层
文字原位黏贴

  1. (defun c:cpz ( / s )
  2.    (if (setq s (ssget)) (command "_.copybase" "_non" '(0 0) s ""))
  3.    (princ)
  4. )
  5. (defun c:pcz ( )
  6.    (command "_.pasteclip" "_non" '(0 0))
  7.    (princ)
  8. )




回复

使用道具 举报

发表于 2022-9-7 19:47 | 显示全部楼层




本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
回复

使用道具 举报

发表于 2022-9-8 00:01 | 显示全部楼层
看蒙了,哪跟哪啊?
回复

使用道具 举报

 楼主| 发表于 2022-9-8 09:50 | 显示全部楼层
本帖最后由 spp_wall 于 2022-9-8 10:37 编辑

效果很好 可惜没有函数 模仿院长写的 但是第一次运行只复制 第二次就执行偏移 第三次才执行改颜色,是什么原因呢?
  1. (defun c:wzyy ()


  2.   (if (setq ss (ssget '((0 . "*TEXT"))))
  3.     (progn
  4.       (setq s0 (entlast))
  5.     (command "copy" ss  "" "d" "0, 0, 0" "" )

  6.       (setq ss1 (command "MOVE" s0 "" "D"  "0.1,0,0"));"0.1,0,0")
  7.       (setq ss2 (command "change" s0  "" "p" "c" "2" ""))
  8.       (command "regen")
  9.     )
  10. (princ)

  11.   )
  12. )

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
回复

使用道具 举报

发表于 2022-9-8 22:31 | 显示全部楼层
(command "copy" (ssget '((0 . "*text"))) "" "non" '(0 0) "non"'(0 0) "move" "p" "" "non" '(0 0) "non" '(0.1 0) "change" "p" "" "p" "c" "2" "" "regen")
回复

使用道具 举报

发表于 2022-9-9 08:11 | 显示全部楼层
根据文字高度判断一下移动距离好点
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-2 01:21 , Processed in 0.252506 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表