乐筑天下

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

[编程交流] HELP: LISP to create multiple

[复制链接]

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-5 20:15:23 | 显示全部楼层
You can try the code in post #9 now.  It should be closer.
 
I still really don't see how you replicate your scenario in post 2.   Good luck  -David
回复

使用道具 举报

48

主题

304

帖子

256

银币

后起之秀

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

铜币
240
发表于 2022-7-5 20:18:05 | 显示全部楼层
 
David. I just left office. Will see if I can try at home.
 
Not sure if I got you correctly, but Regarding post 2, it was just to illustrate what I mean.  From 1 viewport to 4 seperate ones at the same "model view location" but resized to view only 1 specific view each.  
 
Thanks for your effort  
 
Will post the results after I tried it.  
 
Thanks again
回复

使用道具 举报

48

主题

304

帖子

256

银币

后起之秀

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

铜币
240
发表于 2022-7-5 20:23:02 | 显示全部楼层
H David, this is what i got from the updated LISP on post #9
 
 
Pressing Y or N resulted in nothing happening. .
 
Hope you can probe further ,else I do understand & thanks for your effort.
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-5 20:25:49 | 显示全部楼层
 
A locked viewport would lead to an error
 
 
-David
回复

使用道具 举报

48

主题

304

帖子

256

银币

后起之秀

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

铜币
240
发表于 2022-7-5 20:29:35 | 显示全部楼层
 

 
Will try again tomorrow.
 
Thanks David
回复

使用道具 举报

48

主题

304

帖子

256

银币

后起之秀

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

铜币
240
发表于 2022-7-5 20:31:42 | 显示全部楼层
Hi David.
 
This is the results:-
 
- Scale & UCS orientation is same.
- Just that the location of the view is not. As show in the photo below
 
204257ukrrtic8irfckgrt.jpg
 
 
Also, after running the command once, selecting the original viewport or any viewport (current or newly created) to create another viewport results in this:-
 
Selecting Y or N results in nothing happening
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-5 20:35:48 | 显示全部楼层
Post #9 updated.
 
Unless you have the named views saved, from what I've seen, I don't believe you could totally automate the view process.  And even then I doubt the outcome will be exact.  -David
回复

使用道具 举报

48

主题

304

帖子

256

银币

后起之秀

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

铜币
240
发表于 2022-7-5 20:37:22 | 显示全部楼层
 
Hi David
 
Thanks. I have tried the updated lisp.
 
It will now allow creating multiple view port without that error.
 
The final issue is that the views still not the same.  Buy It's ok. Perhaps it cannot be done.
 
Thanks for the help so far.  
 
But I do hope someone out there can solve this issue
 
 
Thanks.
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-5 20:42:30 | 显示全部楼层
Can you post a sample ?
回复

使用道具 举报

0

主题

375

帖子

385

银币

限制会员

铜币
-7
发表于 2022-7-5 20:45:26 | 显示全部楼层
I've made this one, using a different approach
  1. (vl-load-com)(defun C:CPVP (/ *error* acObj acDoc vp enti p1 p2 enti cen sc newcen dims) (setq acObj (vlax-get-acad-object)       acdoc (vla-get-activedocument acObj)       )  (vla-startundomark acDoc)  (defun *error* (msg)   (and     msg     (not (wcmatch (strcase msg) "*CANCEL*,*QUIT*,*BREAK*"))     (princ (strcat "\nError: " msg))   )   (if     (= 8 (logand (getvar 'undoctl) )     (vla-endundomark acDoc)   )   (princ) ) (if   (and     (setq vp (ssget ":E:S:L" '((0 . "VIEWPORT"))))     (setq p1 (getpoint "\nFirst corner: "))     (setq p2 (getcorner p1 "\nSecond corner: "))   )    (progn      (setq p1     (trans p1 1 0)            p2     (trans p2 1 0)            enti   (vla-copy (vlax-ename->vla-object (ssname vp 0)))            sc     (vla-get-CustomScale enti)            newcen (mapcar '(lambda (a b) (/ (+ a b) 2.0)) p1 p2)            dims   (mapcar '- p2 p1)      )      (if (= (vla-get-clipped enti) :vlax-true)        (command "_clip" (vlax-vla-object->ename enti) "_d")      )      (vla-update enti)      (setq cen (vlax-get enti 'center))      (vla-put-mspace acdoc :vlax-true)      (vla-put-activepviewport acdoc enti)      (vla-zoomCenter acObj (vlax-3d-point (trans (trans newcen 3 2) 2 0)) 1)      (vla-put-mspace acdoc :vlax-false)      (vla-put-width  enti (abs (car  dims)))      (vla-put-height enti (abs (cadr dims)))      (vla-put-center enti (vlax-3d-point newcen))      (vla-put-CustomScale enti sc)      (command "_move" (vlax-vla-object->ename enti) "" "_non" p1)      (while (> (getvar 'cmdactive) 0)        (command "\")        )    ) ) (*error* nil) (princ))
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-12 01:12 , Processed in 0.566614 second(s), 72 queries .

© 2020-2025 乐筑天下

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