明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: ga619091

[提问] 物件居中问题

[复制链接]
发表于 2020-3-21 00:58:48 | 显示全部楼层
  • ;;;;取中点函数---enam 实体名-----------------------(一级)------------------------------
  • (defun e-mid (enam / ent typ obj cen_po pt pt10 pt13 pt14 pt15 dis ang)
  •   (setq ent (entget enam))
  •   (setq typ (dxf1 ent 0))
  •   (if (= typ "LINE")
  •     (setq pt (yy:mid (dxf1 ent 10) (dxf1 ent 11)))
  •   )
  •   (if (or (= typ "ARC") (= typ "SPLINE") (and (or (= typ "LWPOLYLINE") (= typ "OLYLINE")) (= (fy-recP enam) nil))) ;;;矩形非闭合多义线
  •     (progn
  •       (setq obj (en2obj enam))
  •       (setq dis (vlax-curve-getdistatparam obj (vlax-curve-getendparam obj)))
  •       (setq pt (vlax-curve-getPointAtDist obj (* dis 0.5))) ;取得中点
  •     )
  •   )
  •   (if (= typ "CIRCLE")
  •     (setq pt (dxf1 ent 10))
  •   )
  •   (if (= typ "DIMENSION")
  •     (progn
  •       (if (= (dxf1 ent 70) 37) ;;圆弧标注
  •         (progn
  •           (setq pt11 (dxf1 ent 11))
  •           (setq pt15 (dxf1 ent 15))
  •           (setq ang (angle pt11 pt15))
  •           (setq pt (polar pt11 ang (* (getvar "dimscale") (+ (* (getvar "dimtxt") 0.5) (getvar "dimgap")))))
  •         )
  •       )
  •       (if (= (dxf1 ent 70) 34) ;;角度标注
  •         (progn
  •           (setq pt11 (dxf1 ent 11))
  •           (setq pt13 (dxf1 ent 13))
  •           (setq pt15 (dxf1 ent 15))
  •           (setq ang (angle pt11 (yy:mid pt13 pt15)))
  •           (setq pt (polar pt11 ang (* (getvar "dimscale") (+ (* (getvar "dimtxt") 0.5) (getvar "dimgap")))))
  •         )
  •       )
  •       (if (vl-position "AcDbAlignedDimension" (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 100)) ent))) ;;;如果对齐32 线性 33 标注
  •         (progn
  •           (setq pt11 (dxf1 ent 10))
  •           (setq pt13 (dxf1 ent 13))
  •           (setq pt14 (dxf1 ent 14))
  •           (setq dis (distance pt14 pt13))
  •           (setq ang (angle pt14 pt13))
  •           (setq pt (polar pt10 ang (* dis 0.5)))
  •         )
  •       )
  •       (if (null pt)
  •         (setq pt (dxf1 ent 11))  ;;;标注文字中心,近似中点
  •       )
  •     )
  •   )
  •   (if (or (= typ "TEXT") (= typ "MTEXT"))
  •     (setq pt (yy:mid (car (txbox enam nil)) (caddr (txbox enam nil))))
  •   )
  •   (if (null pt)
  •     (setq cen_po (get-box (SL:PickSet-fromList (list enam)))
  •       pt (yy:mid (car cen_po) (cadr cen_po))
  •     )
  •   )
  •   pt
  • )
  • ;;----------------------------------------------------------------------------------------------
发表于 2020-3-21 08:02:07 | 显示全部楼层
依然小小鸟 发表于 2020-3-20 13:34
希望能实现这样的功能

这样的效果能实现吗
发表于 2020-3-21 09:59:58 | 显示全部楼层
尘缘一生 发表于 2020-3-21 00:58
  • ;;;;取中点函数---enam 实体名-----------------------(一级)------------------------------
  • ( ...

  • 缺了几个自定义函数
    发表于 2020-4-22 10:27:00 | 显示全部楼层
    依然小小鸟 发表于 2020-3-20 13:34
    希望能实现这样的功能

    这个好!有了吗,发一个学习下。
    发表于 2020-4-22 10:30:12 | 显示全部楼层

    D:\autolisp\【czj】个人函数库\【20200420】批量自动修改梁宽和梁偏位范例图及需求描述\柱居中对齐
    发表于 2020-4-22 10:35:18 | 显示全部楼层

    G版您好,下图所示的这种批量对齐,怎么实现呢。感觉跟您这个很类似的一个思路。
    柱居中对齐后的效果

    柱居中对齐后的效果


    本帖子中包含更多资源

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

    x
    发表于 2020-4-22 12:09:59 | 显示全部楼层
    持续追踪此类问题
    发表于 2020-4-22 23:12:29 | 显示全部楼层
    持续追踪,G版出手
    发表于 2020-6-9 23:34:36 | 显示全部楼层

    请问可以实现实体表格居中吗
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

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

    GMT+8, 2025-7-16 20:30 , Processed in 0.183897 second(s), 20 queries , Gzip On.

    Powered by Discuz! X3.4

    Copyright © 2001-2021, Tencent Cloud.

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