eimimitu 发表于 2022-7-5 15:34:48

(ssget "_p") issue

(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!

Grrr 发表于 2022-7-5 15:47:48

Try with:
 

(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.

eimimitu 发表于 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..

Lee Mac 发表于 2022-7-5 15:59:30

Exploding dimensions!?!

eimimitu 发表于 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...

Grrr 发表于 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.

Lee Mac 发表于 2022-7-5 16:16:52

 
You could alternatively iterate over the dimension block definition, e.g.:
(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.

eimimitu 发表于 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..)

Lee Mac 发表于 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?

eimimitu 发表于 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...?
 

(vla-copy (vlax-ename->vla-object blk))
页: [1]
查看完整版本: (ssget "_p") issue