乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 44|回复: 14

[编程交流] Autodimensioning arc's pl

[复制链接]

4

主题

21

帖子

18

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 12:07:18 | 显示全部楼层 |阅读模式
Hi all,
 
How can i use the command DIMARC on all arc's polyline segment(s) without picking the segment(s) and dimension location?
One more thing the dimensions have to be associative's.
Thank you for any helps.
 
M4rdy.
Autocad 2007
回复

使用道具 举报

1

主题

1069

帖子

1050

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
69
发表于 2022-7-6 12:14:51 | 显示全部楼层
 
Mardi,
This one is from my oldies
Is this what you looking for?
(Check your PM box)
 
  1. ;; Program to dimensioning all polyline segments;;  fixo () 2005 all rights removed;; A2005 / Windows XP;; helper functions : written by Fatty T.O.H.;; ***  group list   ***(defun group-by-num (lst num / ls ret) (if (= (rem (length lst) num ) 0)   (progn     (setq ls nil)     (repeat (/ (length lst) num)(repeat num (setq ls             (cons (car lst) ls)      lst (cdr lst)))(setq ret (append ret (list (reverse ls)))      ls nil)))   )ret );; ***  coordinates  ***(defun get-vexs (pline_obj / verts)     (setq verts (vlax-get pline_obj 'Coordinates)    verts          (cond            ((wcmatch (vlax-get pline_obj 'Objectname )                     "AcDb2dPolyline,AcDb3dPolyline")              (group-by-num verts 3)            )            ((eq (vlax-get pline_obj 'Objectname )                     "AcDbPolyline")              (group-by-num verts 2)            )            (T nil)          )) ) ;; ***  inclined angle  ***(defun dif-angle (ang1 ang2 / def) (set 'ang1      (if (> ang2 (+ pi ang1)) (+ (* pi 2) ang1) ang1      ) ) (set 'ang2      (if (> ang1 (+ pi ang2)) (+ (* pi 2) ang2) ang2      ) ) (setq def (- ang2 ang1)));; ***  test on CW/CCW  ***;; (angdir=0)(defun ccw-test        (pt_list / angle_list) (setq        angle_list (mapcar (function (lambda (x y)                     (angle x y)                   )         )         pt_list         (cdr pt_list) ) ) (if (> (apply        '+        (mapcar        (function (lambda (x y) (dif-angle x y)))                angle_list                (cdr angle_list)        ) ) 0     )   t   nil ));; ***  main programm  ***(defun C:dmp (/ ) (vl-load-com) (setq adoc (vla-get-activedocument (vlax-get-acad-object))) (setq acsp (vla-get-modelspace adoc)) (setq        pl (vlax-ename->vla-object     (car (entsel "\n >> Select pline >> \n"))   ) )(setq        coords (get-vexs pl)) (if (eq :vlax-true (vla-get-closed pl)) (setq        coords (append coords (list (car coords))))) (if (ccw-test coords)(setq dop pi)(setq dop 0)) (setq param_list (mapcar (function (lambda (x)        (fix (vlax-curve-getparamatpoint pl x))))     (mapcar (function (lambda (y)(trans y 0 1))) coords)))(mapcar (function (lambda (x y z)  (cond((not (zerop (setq blg (vla-getbulge pl x))))(progn(setq hgt (* 4 (atan (abs blg)))chord (distance y z)rad (abs (/ chord 2 (sin (/ hgt 2))))mid (trans (vlax-curve-getpointatparam pl (+ (fix x) 0.5)) 0 1);;;cen (trans (mapcar (function (lambda (a b)(/ (+ a b) 2))) y z) 0 1);; fixed by Matthew :      cen (trans (polar y (if (minusp blg)(-(angle y z)(-(/ pi 2)(/ hgt 2)))              (+(angle y z)(-(/ pi 2)(/ hgt 2)))) rad) 0 1) txp (trans (polar mid (if (minusp blg)(angle cen mid)                (angle mid cen))  0 1))(setq dm (vla-adddim3pointangular acsp   (vlax-3d-point cen)   (vlax-3d-point y)   (vlax-3d-point z)   (vlax-3d-point txp)))(vla-put-textoverride dm (rtos (abs (- (vlax-curve-getdistatpoint pl y)                       (vlax-curve-getdistatpoint pl z))) 2 2))))(T (progn    (setq mid (trans (vlax-curve-getpointatparam pl (+ (fix x) 0.5)) 0 1))    (setq txp (trans (polar mid (+ dop (angle y z) (/ pi 2)) 8.) 0 1))    (vla-adddimaligned acsp    (vlax-3d-point y)   (vlax-3d-point z)   (vlax-3d-point txp))    )))))param_listcoords(cdr coords)) (princ))(princ "\n\t***\tPLINE DIMENSIONING\t***\n")(princ "\nType DMP to execute\n")(prin1)
 
~'J'~
回复

使用道具 举报

4

主题

21

帖子

18

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 12:16:25 | 显示全部楼层
Thank you FIXO for your reply.
Yes, indeed i had your DMP's. But as i posted before, is it possible to make the dimensions to be associative's?
回复

使用道具 举报

4

主题

21

帖子

18

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 12:22:41 | 显示全部楼层
And one more thing, i found error on different UCS angle.
Command:  DMP
>> Select pline >>
; error: bad argument type: numberp: nil
 
M4rdy
回复

使用道具 举报

1

主题

1069

帖子

1050

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
69
发表于 2022-7-6 12:28:03 | 显示全部楼层
 
I wrote it many moons ago for WCS only
Ok I will see what I can to rewrite for different UCS
Easier yet to set world / restore current UCS btw
 
~'J'~
回复

使用道具 举报

1

主题

1069

帖子

1050

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
69
发表于 2022-7-6 12:31:03 | 显示全部楼层
 
Hi Mardy
I figured out how to get it to work in the different UCS
just added few lines of code
Let me know how it will be work
 
~'J'~
DimPoly.LSP
回复

使用道具 举报

4

主题

21

帖子

18

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 12:33:45 | 显示全部楼层
It works perfectly. Just curious, why do you use dimangular (vla-adddim3pointangular) then override the text for arc segments? I've tried to use dimarc, but i had no luck. What's wrong with that?
Thank you sir.
 
m4rdy
回复

使用道具 举报

1

主题

316

帖子

311

银币

初来乍到

Rank: 1

铜币
29
发表于 2022-7-6 12:40:06 | 显示全部楼层
(acdimenableupdate T)
回复

使用道具 举报

4

主题

21

帖子

18

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 12:44:40 | 显示全部楼层
Wait a minute...FIXO i have a little problem with your dmp. If the arc segment as the last segment on closed pline, the result goes wrong.
 
回复

使用道具 举报

1

主题

1069

帖子

1050

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
69
发表于 2022-7-6 12:46:04 | 显示全部楼层
 
Ok, I will try
 
~'J'~
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-5 10:30 , Processed in 0.398032 second(s), 72 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表