乐筑天下

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

[编程交流] rotate3d Lisp, Need help

[复制链接]

40

主题

177

帖子

100

银币

后起之秀

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

铜币
248
发表于 2022-7-5 20:19:45 | 显示全部楼层
hello!someone can help me?
 
I want rotate 3DSolid like this ,not a block, can do?
回复

使用道具 举报

0

主题

301

帖子

301

银币

初来乍到

Rank: 1

铜币
0
发表于 2022-7-5 20:22:34 | 显示全部楼层
liuhaixin,
 
You can rotate solid. Only problem is getting your base point for rotation.
As you know entity list is kind of encrypted.
 
You could get the min of the bounding box and rotate around this point.
 
  1. (defun c:3dsr ( / ** ang axs bpt ent obj )   (while       (progn (setvar 'errno 0) (setq ent (car (entsel "\nSelect Solid to rotate: ")))           (cond               ((= 7 (getvar 'errno)) (princ "\nMissed, try again."))               ((/= 'ename (type ent)) nil)               ((/= "3DSOLID" (cdr (assoc 0 (entget ent)))) (princ "\nPlease select a Solid."))               ((setq obj (vlax-ename->vla-object ent)                      **  (vla-getboundingbox obj 'mini 'maxi)                      bpt (vlax-safearray->list mini)                                             ang (/ pi 2.0)                   )                   (princ "\nRotate about [X/Y/Z] : ");;;;; Rest of the code is same;;;;;;;;;
 
ymg
回复

使用道具 举报

40

主题

177

帖子

100

银币

后起之秀

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

铜币
248
发表于 2022-7-5 20:25:58 | 显示全部楼层
Oh! is cool.Thanks ymg.
but I find Y-axis and Z-axis exchange. press"Y" is rotation around the "Z" axis. press"Z" is rotation around the "Y" axis.
回复

使用道具 举报

0

主题

301

帖子

301

银币

初来乍到

Rank: 1

铜币
0
发表于 2022-7-5 20:29:34 | 显示全部楼层
liuhaixin,
 
I believe you are mistaken.
 
Lee's order for the rotation is correct.
 
ymg
回复

使用道具 举报

40

主题

177

帖子

100

银币

后起之秀

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

铜币
248
发表于 2022-7-5 20:31:59 | 显示全部楼层
 
 
ymg,
I'm sorry!I was wrong!
I created a new document, test, It's OK!
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 20:35:44 | 显示全部楼层
Thank you for stepping in ymg, good explanation.
回复

使用道具 举报

2

主题

53

帖子

57

银币

初来乍到

Rank: 1

铜币
14
发表于 2022-7-5 20:37:40 | 显示全部楼层
Lee
 
Is it a simple modification for the block rotate routine to work with multiple blocks at a time?  How would I go about changing it?
Thanks
Pads
回复

使用道具 举报

0

主题

1

帖子

1

银币

初来乍到

Rank: 1

铜币
0
发表于 2022-7-5 20:40:35 | 显示全部楼层
Hi everybody,
 
I need to use ROTATE3D on texts. I have over 2000 texts on TOP view and I want to rotate them so that I can read them on LEFT view.
I need a lisp to Rotate3D multiple texts around their own base point, -90 degrees on Y Axis.
 
I would really appreciate any help.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 20:43:56 | 显示全部楼层
 
Try the following modification of my earlier code:
  1. ([color=BLUE]defun[/color] c:3drtxt ( [color=BLUE]/[/color] ang axs idx lst obj sel )   ([color=BLUE]setq[/color] ang ([color=BLUE]/[/color] [color=BLUE]pi[/color] 2.0))   ([color=BLUE]if[/color] ([color=BLUE]setq[/color] sel ([color=BLUE]ssget[/color] [color=MAROON]"_:L"[/color] '((0 . [color=MAROON]"TEXT,MTEXT"[/color]))))       ([color=BLUE]progn[/color]           ([color=BLUE]repeat[/color] ([color=BLUE]setq[/color] idx ([color=BLUE]sslength[/color] sel))               ([color=BLUE]setq[/color] lst                   ([color=BLUE]cons[/color]                       ([color=BLUE]cons[/color] ([color=BLUE]setq[/color] obj ([color=BLUE]vlax-ename->vla-object[/color] ([color=BLUE]ssname[/color] sel ([color=BLUE]setq[/color] idx ([color=BLUE]1-[/color] idx)))))                           ([color=BLUE]vlax-get[/color] obj                               ([color=BLUE]if[/color] ([color=BLUE]or[/color] ([color=BLUE]=[/color]  [color=MAROON]"AcDbMText"[/color]   ([color=BLUE]vla-get-objectname[/color] obj))                                       ([color=BLUE]=[/color] [color=BLUE]acalignmentleft[/color] ([color=BLUE]vla-get-alignment[/color] obj))                                   )                                   'insertionpoint                                   'textalignmentpoint                               )                           )                       )                       lst                   )               )           )           ([color=BLUE]princ[/color] [color=MAROON]"\nRotate about [X/Y/Z] : "[/color])           ([color=BLUE]while[/color]               ([color=BLUE]setq[/color] axs                   ([color=BLUE]cdr[/color]                       ([color=BLUE]assoc[/color] ([color=BLUE]grread[/color] [color=BLUE]nil[/color] 10)                          '(                               ((2 120) 1.0 0.0 0.0)                               ((2 088) 1.0 0.0 0.0)                               ((2 121) 0.0 1.0 0.0)                               ((2 089) 0.0 1.0 0.0)                               ((2 122) 0.0 0.0 1.0)                               ((2 090) 0.0 0.0 1.0)                           )                       )                   )               )               ([color=BLUE]foreach[/color] itm lst                   ([color=BLUE]vlax-invoke[/color] ([color=BLUE]car[/color] itm) 'rotate3d ([color=BLUE]cdr[/color] itm) ([color=BLUE]mapcar[/color] '[color=BLUE]+[/color] ([color=BLUE]cdr[/color] itm) axs) ang)               )           )       )   )   ([color=BLUE]princ[/color]))([color=BLUE]vl-load-com[/color]) ([color=BLUE]princ[/color])
回复

使用道具 举报

7

主题

110

帖子

104

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 20:47:13 | 显示全部楼层
 
+1!
 
Thank you Lee.... i never knew i needed this but it is very nice
 
AutoDesk should hire some people like you.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-12 01:07 , Processed in 0.445624 second(s), 70 queries .

© 2020-2025 乐筑天下

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