Jump to content

Convert dimension picture to native dimension


Recommended Posts

Posted

Hi there,

 

I'm trying to modify a diametric dimension which has a block reference that makes up its picture, and turn it to its native view. If you can kindly check the attached drawing, you can see that there is a sample dimension exported from Revit, what I achieved so far and the desired result side by side.

 

With the following code I managed to loop through the dimension "block", find the mtext object and its insertion point. Then I modify the "dimension"s textposition with the insertion point at hand but somehow the justification of text changes and I can not get the desired orientation.

 

I'll really appreciate your helps to make it as close as to the original view. Thanks!

 

(defun c:fixdim()
 (setq dim (car(entsel)))
 (setq dim-obj (vlax-ename->vla-object dim))
 (setq dimtxtloc (get-dimblktxtloc dim))
 (setq s-array (vlax-make-safearray vlax-vbdouble '(0 . 2)))  
 (vla-put-textposition dim-obj (vlax-safearray-fill s-array dimtxtloc))
 )

(defun get-dimblktxtloc (dim-ename)
 (setq dim-entity (vl-catch-all-apply 'entget (list dim-ename)))
 (cond
   ((not (vl-catch-all-error-p  dim-entity))
    (setq dim-blockname (cdr (assoc 2 dim-entity)))
    (setq blk-object (get-dimblkobj dim-blockname))
    (cond
      ((not (vl-catch-all-error-p  blk-object))
(vlax-for subobj blk-object
  (cond
    ((= (vla-get-objectname subobj) "AcDbMText")
     (setq blk-txtloc (safearray-value (vlax-variant-value (vla-get-insertionpoint subobj))))
     )
    )
  )
)
      )
    )
   )
 blk-txtloc
 )
 
(defun get-dimblkobj (blockname)
 (vl-catch-all-apply 'vla-item (list (vla-get-blocks (vla-get-ActiveDocument (vlax-get-acad-object))) blockname))
 )
 

Dimension Picture.dwg

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