Jump to content

Programming on associative and nonassociative dimensions


Ahankhah

Recommended Posts

Hi CADmates,

 

I have drawings full of dimensions overlapping on each other.

Should any one let me know how to get rid of this position via programming?

 

I tried some coding to move text of dimensions, but no success on associative dimensions.

 

;|
(MT:Move:DimensionText<-Ename (car (entsel)) nil 0 1 0)
|;
(defun MT:Move:DimensionText<-Ename
      (%ename% %absolute|relative% %x% %y% %z% / *entlist* *assoc11*)
(setq *entlist* (entget %ename% '("*")))
(cond
 ((/= (cdr (assoc 0 *entlist*)) "DIMENSION") nil)
 (T
  (setq *assoc11* (cdr (assoc 11 *entlist*))); text position
  (setq *assoc11*
   (if %absolute|relative%
    (list %x% %y% %z%)
    (list (+ %x% (car *assoc11*)) (+ %y% (cadr *assoc11*)) (+ %z% (caddr *assoc11*)))
   )
  )
  (setq *entlist* (subst (cons 11 *assoc11*) (assoc 11 *entlist*) *entlist*))
  (entmod *entlist*)
 )
)
)

I appreciate any help

Link to comment
Share on other sites

Hi CADmates,

 

I have drawings full of dimensions overlapping on each other.

Should any one let me know how to get rid of this position via programming?

 

I tried some coding to move text of dimensions, but no success on associative dimensions.

 

hi Ahabkhah

my $0.02 maybe vla-method?

(defun MT:Move:DimensionText<-Ename (%ename% [color="red"]%absolute|relative%[/color] pt / obj)
(setq obj (vlax-ename->vla-object %ename% ))
(if [color="red"]%absolute|relative%[/color]
(vla-put-TextMovement obj 0)
(vla-put-TextMovement obj 2); 1= with leader
 )
(vla-put-TextPosition obj (vlax-3d-point pt))
 )

im not sure %absolute|relative% means?

or (acdimenableupdate nil) ?

 

so i just assume t= relocate text & dim , nil= just relocate text ?

 

(MT:Move:DimensionText<-Ename (car(entsel)) [color="red"]t[/color] (getpoint))

my apology if it doesn't help

Edited by hanhphuc
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...