乐筑天下

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

[编程交流] (ssget "_p") issue

[复制链接]

8

主题

38

帖子

30

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-5 15:34:48 | 显示全部楼层 |阅读模式
  1. (setq axd (vla-AddDimAligned spc d1 d2 ex))(vla-Copy axd)(vl-cmdf "_.explode" "_l" "") ;could not find an ActiveX equivalent for this(setq del (ssget "_p")) ;errors here, does not set the variable and exits routine
 
Can someone shed some light? What is the deal with the above?
I am able to type the last expression at the command line after error and it sets the variable fine, so it seems to recognize the previous entities after lisp exits but not during for some reason.
 
Also, is there a way to explode dims other than the command method?
 
Thanks in advance!
回复

使用道具 举报

66

主题

1552

帖子

1514

银币

后起之秀

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

铜币
325
发表于 2022-7-5 15:47:48 | 显示全部楼层
Try with:
 
  1. (setq e (entlast))(setq axd (vla-AddDimAligned spc d1 d2 ex))(command "_.EXPLODE" (ssadd (vlax-vla-object->ename axd))  "")(setq SS (ssadd))(while (setq e (entnext e)) (ssadd e SS))(sssetfirst nil SS)
 
Looks like IAcadDimAligned doesn't have Explode method, so you'll have to stick with the command approach.
回复

使用道具 举报

8

主题

38

帖子

30

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-5 15:54:16 | 显示全部楼层
That did it Grrr... million thanks.. I'm was even able to iterate and process selection without the need for ssget or ssadd thanks to your tip! Bummer about the explode command... though..
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 15:59:30 | 显示全部楼层
Exploding dimensions!?!
回复

使用道具 举报

8

主题

38

帖子

30

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-5 16:03:59 | 显示全部楼层
I was waiting for that...
 
Exploding the copy of the original to be fair...
 
Only to extract the arrow blocks and manipulate them to look like they are in isometic view... working on iso projection dimensioning...
回复

使用道具 举报

66

主题

1552

帖子

1514

银币

后起之秀

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

铜币
325
发表于 2022-7-5 16:13:10 | 显示全部楼层
I tought the same as Lee,
Alternatively would be to extract the Arrowhead1Block and Arrowhead2Block properties and insert the blocks at ExtLine1Point and ExtLine2Point property-points (or something like this).
I would be careful when using Explode, so I'd use Undomarks/*error* function in my routine.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 16:16:52 | 显示全部楼层
 
You could alternatively iterate over the dimension block definition, e.g.:
  1. (defun c:test ( / blk ent enx )   (if       (and           (setq ent (car (entsel "\nSelect dimension: ")))           (setq enx (entget ent))           (wcmatch (cdr (assoc 0 enx)) "*DIMENSION")           (setq blk (tblobjname "block" (cdr (assoc 2 enx))))       )       (while (setq blk (entnext blk))           (print (cdr (assoc 0 (entget blk))))       )   )   (princ))
 
Also refer to my LM:getdimstring function.
回复

使用道具 举报

8

主题

38

帖子

30

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-5 16:24:12 | 显示全部楼层
I considered this approach... Only issue is that most commonly used arrowhead is "Closed Filled" which, in my version of ACAD at least, is not a block definition at all but a solid... Any suggestions for solving this?
 
So instead of vla-getting Arrowhead1or2Block, inserting it on screen and modifying it, I opted for exploding a copy of the final dimension, extracting arrows and erasing/purging all the leftovers... Not ideal because of having to call the command but works pretty good. I'm also forced to call other commands, specifically "DIMALIGNED" because vla-AddDimAligned doesn't create an object associated dimension as far as I understand. I also could not find any method to associate after creation as in the "DIMREACCOSIATE" command.
 
A bit off topic but, quick question for you lisp masters..
What can you tell me about stacked fractions in fields...
As far as I know there's no standard option for this...
Theoretical solution which I haven't really looked into is Diesel Expressions in combo with Formatting Codes (Lee's routine reminded me of it)
Uses would be:
Viewport scale, Height of an Extrusion, Coordinate Point Position and such
I want to be able to match standard format for my drawings which is all fractions stacked
I want to use fields for its auto update capability
Any workaround that you can think of?
Just thought of another theoretical solution: Fields to mtext string in combo with object reactor???? (just spitball-ing but..)
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 16:29:01 | 显示全部楼层
 
You misunderstood.
 
I am not referring to the block definition of the arrowhead, but the block definition of the dimension itself - this will apply to all dimensions, regardless of the arrowhead used.
 
Did you try my code with your dimensions?
回复

使用道具 举报

8

主题

38

帖子

30

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-5 16:40:46 | 显示全部楼层
ooh I think I'm following now... you're approach iterates to the original dimension without needing to explode it... then it's a matter of extracting the needed entities from the block definition itself.. Yes?
 
what method would you use to extract arrows...?
 
  1. (vla-copy (vlax-ename->vla-object blk))
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-7-1 10:42 , Processed in 1.390020 second(s), 72 queries .

© 2020-2025 乐筑天下

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