Jump to content

Recommended Posts

Posted
I am talking about this property

 

To overide this property on dimensions please check this thread.

 

Regards,

Mircea

  • Replies 43
  • Created
  • Last Reply

Top Posters In This Topic

  • MSasu

    14

  • pBe

    10

  • jan_ek

    10

  • Lee Mac

    4

Top Posters In This Topic

Posted Images

Posted

Will it be fine. Will there be the unexpected errors.

 

(defun a_sc (/ dims sc)
(vl-load-com)
(setq dims (car (entsel "\nPick Dimension line: ")));
(setq sc (vla-get-ScaleFactor (vlax-ename->vla-object dims)))
)

Posted

Your code works well on my station; the only correction that I can suggest is to add a protection for missed/wrong selection:

 

(defun a_sc ( / dims sc)
(vl-load-com)

(prompt "\nPick Dimension line... ")
(if (setq dims (ssget "_:S:E" '((0 . "DIMENSION"))))
 (setq sc (vla-get-ScaleFactor (vlax-ename->vla-object (ssname dims 0))))
)
)

Regards,

Mircea

Posted

Another, should you wish to use Vanilla AutoLISP:

 

;; Get DimScale  -  Lee Mac
;; Returns the DimScale for a supplied Dimension Entity
;; dim = Dimension entity

(defun _getdimscale ( dim / _override->dxf )

   (defun _override->dxf ( lst / x1 )
       (if (setq x1 (assoc 1070 lst))
           (cons
               (cons (cdr x1) (cdar (setq lst (cdr (member x1 lst)))))
               (_override->dxf lst)
           )
       )
   )

   (cond
       (   (cdr (assoc 40 (_override->dxf (cdadr (assoc -3 (entget dim '("ACAD"))))))))
       (   (cdr (assoc 40 (tblsearch "DIMSTYLE" (cdr (assoc 3 (entget dim)))))))
   )
)

Test Function:

 

(defun c:test ( / s )
   (if (setq s (ssget "_+.:E:S" '((0 . "DIMENSION"))))
       (_getdimscale (ssname s 0))
   )
)

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