convert dimension to text auto lisp

convert dimension to text auto lisp

Gaganpatel
Collaborator Collaborator
2,165 Views
7 Replies
Message 1 of 8

convert dimension to text auto lisp

Gaganpatel
Collaborator
Collaborator

 

Dear All,

I want to convert dimension to text auto lisp.

 

 

0 Likes
2,166 Views
7 Replies
Replies (7)
Message 2 of 8

roland.r71
Collaborator
Collaborator

Explode (?)

0 Likes
Message 3 of 8

Anonymous
Not applicable

An explode will do just that arrows,text, lines all the bits.

 

A better way read the text part of the dim and create a TEXT.

 

(defun c:test ( / obj txt ins)
(vl-load-com) (while (setq obj (vlax-ename->vla-object (car (entsel "pick object")))) (setq txt (vla-get-measurement obj)) (setq ins (vlax-safearray->list (vlax-variant-value(vla-get-textposition obj)))) (vla-delete obj) (command "-text" ins "" (rtos txt 2 3)) ) )
Message 4 of 8

roland.r71
Collaborator
Collaborator

It depends on what OP means/wants.

Which i was trying to figure out before spending time on coding anything.

For all we know, he just might want his dimension text to become static.

0 Likes
Message 5 of 8

Anonymous
Not applicable

O resultado será o mesmo, outra opção é a variável DIMASSOC 2 com isso as dimensões serão geradas explodidas automaticamente.

 

DIMASSOC <2> 

 

 

0 Likes
Message 6 of 8

roland.r71
Collaborator
Collaborator

@Anonymous wrote:

The result will be the same, another option is the variable DIMASSOC 2 with that the dimensions will be generated exploded automatically.

 

DIMASSOC <2> 

 


If OP doesn't want to retain his dimensions (& explode is therefor an option) this might be his best option, yes.

But it all depends on what OP wants, exactly / in detail.

Message 7 of 8

Kent1Cooper
Consultant
Consultant

I agree that more information is needed about the intent.  If  what you want is the text content only, and the rest of the Dimension removed, and if  you're talking about linear/rotated/aligned or angular or ordinate varieties of Dimensions [this doesn't work  on radius or diameter Dimensions], you can do this:

(command "_.explode" (car (entsel)) "_.erase" "_previous" "_remove" "_last" "")

 

because when you Explode anything, the pieces become the "previous" selection, and when you Explode a Dimension of those kinds, the text part becomes the "last" object.

Kent Cooper, AIA
Message 8 of 8

john.uhden
Mentor
Mentor

That appears to be concise and harmless, but I think I would add code after the entsel to verify what the object is and to warn the user if not a qualifying dimension.

John F. Uhden

0 Likes