Jump to content

elements in position other than z0 ...help


leonucadomi

Recommended Posts

hello all:

 

I have a routine that moves objects to z0. .. is perfect

 

but I would like a routine that warns me that the drawing has elements in a different position than z0.

 

I mean run it, and tell me that there are such a number of different elements in z0.

 

anybody can i help me?

 

 

thanks

 

 

Link to comment
Share on other sites

You should know by now how to do a ssget say line,arc, circle,pline and depending on object, then look at each entity property checking Z value. For a big dwg may not be fast. 

  • Thanks 1
Link to comment
Share on other sites

 

the drawings that I handle are not greater than 1mb,  normally they should be flat ,  but I was surprised that there are elements in a different position than z0

maybe someone has something that can help me detect them.

Link to comment
Share on other sites

Change view front? Everything should be on one line if they are on the same elevation.

 

(defun C:FrontView ()
  (command-s "-vpoint" "0,-1,0")
)

 

  • Thanks 1
Link to comment
Share on other sites

Hi,

 

I would prefer two steps:

1) check, if there is something on z/=0

Use systemvariables EXTMIN and EXTMAX, both tell you the hightest/lowest x,y,z

Could also be used to see, if there are objects outside the defined drawing area

 

2) if any of extmin or extmax tells you, there is something with z/=0, check the bounding-boxes :

(defun c:test (/ j k minp maxp)
  (vl-load-com)
  (vlax-for obj (vla-get-blocks  ; <-- only checks block-definitions 
                   (vla-get-activedocument (vlax-get-acad-object))
                   ) ;_ end of vla-get-blocks
    (setq bbox
           (vl-catch-all-apply 'vla-getboundingbox (list obj 'j 'k))
          ) ;_ end of setq
    (if (vl-catch-all-error-p bbox)
      ()
      (progn
        (setq zminp (caddr (vlax-safearray->list j)))
        (setq zmaxp (caddr (vlax-safearray->list k)))
        (if (OR (< zminp -1) (> zmaxp 1))
          (princ
            (strcat
              "\nObject: "
              (if
                (vl-catch-all-apply 'vla-get-effectivename (list obj))
                 (vla-get-effectivename obj)
                 (vla-get-name obj)
                 ) ;_ end of if
              " Z-min: "
              (rtos zminp)
              " Z-max: "
              (rtos zmaxp)
              ) ;_ end of strcat
            ) ;_ end of princ
          ) ;_ end of if
        ) ;_ end of progn
      ) ;_ end of if
    ) ;_ end of vlax-for
  ) ;_ end of defun
(c:test)

 

regards

Wolfgang

  • Like 1
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...