乐筑天下

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

[编程交流] 仅对外部进行尺寸标注。。

[复制链接]

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 15:50:34 | 显示全部楼层
和一些看台一样,这是一个十进制错误。5s-没什么大不了的!
回复

使用道具 举报

5

主题

21

帖子

16

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-5 15:53:02 | 显示全部楼层
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 15:55:09 | 显示全部楼层
 
indeed a good start!
IMO the idea / algorithm is worth more than coding.
simple, short & faster than region boolean acUnion which need rounding tolerance
 
 
 
hi to be outside 100% the best solution is to involve or to learn coding !
Ronjonp has done 90% of your tasks
 
my $0.02, In red to be tested
  1. (defun [b][color="blue"]outline_TX[/color][/b] (p1 p2 h [color="red"][b][u]cw[/u][/b][/color] / pl d ro);hanhphuc  (setq pl (mapcar ''((x) (list (car x) (cadr x))) (list p1 p2))) (mapcar ''((a b) (set a (apply b pl))) '(ro d) '(angle distance)) (entmakex   (mapcar 'cons    '(0 100 100 1 10 40 50 8 71 72)    (list "MTEXT"          "AcDbEntity"          "AcDbMText"[color="red"]                  (if (or [b][u]cw[/u][/b](< (* pi 0.5) ro (* pi 1.5)) )            (strcat (rtos d 2) "\\P ")            (strcat "\\P " (rtos d 2))            )[/color]          (apply 'mapcar (cons ''((a b) (/ (+ a b) 2.)) pl )          (if (zerop h)            (/ d[color="red"] 10.[/color])            h            )          ([color="red"]LM:[/color]MakeReadable ro)          "OUT"          5          5          )    )   ) (princ) )
回复

使用道具 举报

5

主题

21

帖子

16

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-5 15:59:56 | 显示全部楼层
Hi hanhphuc,
 
 
Trying to learn the coding but something like this is beyond my reach - it helps when there are notes in the code so you know what's happening.
 
 
 
 
wasn't sure if you meant to place your code in Ronjonp's as a 'standalone' it errors malformed list?
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 16:00:10 | 显示全部楼层
 
Good to hear you are learning
you are right this is not simple.
you can't simply add in the code, causing malformed list - missing parentheses or bracket ( ) or extra bracket ! to debug , command VLIDE or VLISP to open the editor
 
a sub-function needs to supply arguments.
i modified previous post#13 outline_TX function with additional argument cw. please re-copy
quick & dirty test
you try to draw 2 rectangles ccw & cw to test..
  1. (defun c:test (/ s v ov l) (setq        v  '(angdir angbase)ov (mapcar 'getvar v)) (mapcar 'setvar v (list 1 (/ pi 2.))) (while (setq s (ssget "_:S:E+." '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1))))   (setq l (mapcar 'cdr (vl-remove-if ''((x) (/= (car x) 10)) (entget (ssname s 0)))))   (mapcar ''((a b) ([color="blue"][b]outline_TX[/b][/color] a b 0. [color="red"](LM:ListClockwise-p l)[/color]))    l    (append (cdr l) (list (car l)))    )   ) (mapcar 'setvar v ov) (princ) )     ;; List Clockwise-p - Lee Mac     ;; Returns T if the point list is clockwise oriented     (defun LM:ListClockwise-p ( lst )       (minusp         (apply '+           (mapcar             (function               (lambda ( a b )                 (- (* (car b) (cadr a)) (* (car a) (cadr b)))               )             )             lst (cons (last lst) lst)           )         )       )     )
回复

使用道具 举报

5

主题

21

帖子

16

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-5 16:05:08 | 显示全部楼层
Thanks  hanhphuc  I appreciate the help but feel I drowning!
 
 
I found if I add to Ronjonp's Code
  1. (setvar 'luprec 2)
it places the text outside - is there a problem doing it this way?
 
 

[code] (defun c:foo (/ lm:makereadable _colinear a b d out p pp s th) ;; RJP 05.03.2018 ;; Labels exterior edges of 'stands' with edge length (defun _colinear (p1 p2 p3 f) (equal (+ (distance p1 p2) (distance p2 p3)) (distance p1 p3) f)) ;; Make Readable  -  Lee Mac ;; Returns a given angle corrected for text readability (defun lm:makereadable (a)   ((lambda (a)      (if (and (< (* pi 0.5) a) (
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-5 16:07:21 | 显示全部楼层
Here's an old routine that should work with a Heavy (not LWpolyline ) Closed PLine outer border  -David
DIM-CPL.LSP
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 16:10:05 | 显示全部楼层
linear units precision 2,similar (rtos x 2 2)
nothing to do with placement
 
To suit your drawing, try to modify/add in the code post#13 (in red)
  1.   (defun [color="blue"]OUTLINE_TX[/color] (p1 p2 h cw  / pl d ro) (setq pl (mapcar '(lambda(x) (list (car x) (cadr x))) (list p1 p2))) (mapcar '(lambda(a b) (set a (apply b pl))) '(ro d) '(angle distance)) [color="red"](setq d (* d 0.001))[/color] (entmakex .....          .....
 
sorry about the 500 internal server error very painful to reply post
 
iMO it's diffucult for you as newbie,
nvm i try my best to assist, example in Ronjop's code just replace this part
  1. (setq pp (polar (car pt) (- (cadddr pt) (/ pi 2.)) th)) (entmakex (list '(0 . "TEXT")                 '(100 . "AcDbEntity")                 '(8 . "BoothOutlineLength")                 '(100 . "AcDbText")                 (cons 10 pp)                 (cons 40 th)                 '(62 . 1)                 (cons 1 (rtos (/ (last pt) 1000.) 2 0))                 (cons 50 (lm:makereadable (cadddr pt)))                 '(72 . 1)                 (cons 11 pp)                 '(100 . "AcDbText")                 '(73 . 2)           ) )
 
to this.
 
  1. [color="green"] ;; modified by hanhphuc [/color]       ([color="blue"]OUTLINE_TX[/color] (cadr pt) (caddr pt) 500 (LM:ListClockwise-p (apply 'append (mapcar ''((x)(list (cadr x)(caddr x))) out ))))
 
It's simple right? ( OUTLINE_TX FromStartPoint ToEndPoint Text_Height ClockWise_Predicate )
; with 4 arguments. in blue is the function symbol & in deep purple is argument
as you can see i also used Lee Mac's function LM:ListClockwise-p
回复

使用道具 举报

58

主题

3353

帖子

33

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1761
发表于 2022-7-5 16:13:58 | 显示全部楼层
 
Really? With the example drawing you gave it appeared to be working correctly. Be aware that this code only looks at straight edges. If you have an edge with a bulge, it will return an incorrect length.
回复

使用道具 举报

5

主题

21

帖子

16

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-5 16:17:45 | 显示全部楼层
it was a decimal error as some of the stands had .5s - no biggy!
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-14 13:04 , Processed in 0.626529 second(s), 72 queries .

© 2020-2025 乐筑天下

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