乐筑天下

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

[编程交流] Area of Polyline & Multiply by

[复制链接]

8

主题

41

帖子

33

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 06:38:50 | 显示全部楼层 |阅读模式
Hi,
 
I am in need of a lisp to do the following
 
Find the individual area of poly line in layer 1 & Layer 2
Multiply the area in layer 1 by a factor 3.1 and Place text within polyline
Multiply the area in layer 2 by factor 4.1 and Place text within polyline
Sum of text as alert message
 
Please help me on this..
 
 
Thanks in Advance
 
Suriwaits
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 06:53:15 | 显示全部楼层
  1. (defun c:areafrom  (/ data TotalArea ss i en area lay) (setq data '(("LAYER1" 3.1) ("LAYER2" 4.1)));;vla-object en) 'mn 'mx)        (setq pt               (mapcar '(lambda (x y)                       (* 0.5 (+ x y)))                          (vlax-safearray->list mn)               (vlax-safearray->list mx)))                      (entmakex (list (cons 0 "TEXT")                        (cons 10 pt)(cons 8 lay)                        (cons 11 pt)                        [b][color="blue"](cons 40 TextHt)                        '(72 . 1) '(73 . 2) [/color][/b]                        (cons 1 (rtos (setq area (* (cadr (assoc lay data)) area)) 2 2))                  )        )        (setq TotalArea (cons area TotalArea))      )        (alert (Strcat "Total area:   " (rtos (apply '+ TotalArea) 2 2)))    ) ) (princ))
 
Code updated
回复

使用道具 举报

8

主题

41

帖子

33

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 07:00:48 | 显示全部楼层
Exactly what i am looking for.
I appreciate you can help me to control the size of text
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 07:10:59 | 显示全部楼层
We can add a prompt for Text Height. Which one did you use? Demo or Demo2?
回复

使用道具 举报

8

主题

41

帖子

33

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 07:16:26 | 显示全部楼层
I used Demo2.
Is it possible to write the area value divided by 1000000 incase i use in mm units.
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 07:28:10 | 显示全部楼层
 
See update code at post # 2
 
HTH
回复

使用道具 举报

8

主题

41

帖子

33

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 07:34:43 | 显示全部楼层
Awesome!
 
Thanks agian pBe for your efforts
 
I have changed factor for mm 0.000001 insted of 0.001 since it is area.
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 07:44:31 | 显示全部楼层
 
Oh yeah.. silly me.. Glad i could help
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 14:53 , Processed in 0.904856 second(s), 68 queries .

© 2020-2025 乐筑天下

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