Jump to content

change all z of point to 0.0


new_mem

Recommended Posts

You can do this without a lisp by simply selecting all of the points in Top view, and in Properties set the Z values (which will indicate Varies) to 0.0

Link to comment
Share on other sites

None of the entities in the dwg are coplanar with the XY plane of the WCS.

 

You can try this:

Set the UCS to the WCS (_UCS > _World) and then use the _Flatten command.

Link to comment
Share on other sites

Hi,

 

Flatten done then object run to another location.

I mean write code lisp following but ellip not effect:

(defun c:test  ()
 (setq ss (ssget '((0 . "ARC"))))
 (setq n 0)
 (repeat (sslength ss)
   (setq arc (vlax-ename->vla-object (ssname ss n)))
   (setq str (vlax-get arc 'StartPoint))
   (setq end (vlax-get arc 'EndPoint))
   (setq cen (vlax-get arc 'Center))
   (setq str_n (list (car str) (cadr str) 0.0))
   (setq end_n (list (car end) (cadr end) 0.0))
   (setq cen_n (list (car cen) (cadr cen) 0.0))
   (command "_ARC" "C" "_none" cen_n "_none" str_n "_none" end_n)
   (vla-delete arc)
   (setq n (1+ n))
   )
 (princ)

 )

Link to comment
Share on other sites

Maybe I have misunderstood, but how do you propose to change the Z coordinates of entities without moving them?

Notice that the normal of most entities is (0.00684151 -7.95332e-005 0.999977) instead of (0 0 1). So everything is slightly tilted relative to the XY plane of the WCS.

Link to comment
Share on other sites

Your drawing is very peculiar. Not only are there undesirable 3D effects, the elliptical arcs all seem to have a major and minor radius that is almost equal (in other words: they are virtually circular).

 

With that in mind here is a function, similar to your suggestion, to create arc replacements in the Z=0 plane for both the arcs and the elliptical arcs:

(vl-load-com)

(defun c:Test  ( / enm idx ss)
 (setq doc (vla-get-activedocument (vlax-get-acad-object)))
 (vla-endundomark doc)
 (vla-startundomark doc)
 (setvar 'cmdecho 0)
 (if (setq ss (ssget '((0 . "ARC,ELLIPSE"))))
   (repeat (setq idx (sslength ss))
     (setq enm (ssname ss (setq idx (1- idx))))
     (if (not (vlax-curve-isclosed enm))
       (progn
         (command
           "_.arc"
           "_non"
           (mapcar '* (vlax-curve-getstartpoint enm) '(1.0 1.0 0.0))
           "_non"
           (mapcar
             '*            
             (vlax-curve-getpointatdist
               enm
               (* 0.5 (vlax-curve-getdistatparam enm (vlax-curve-getendparam enm)))
             )
             '(1.0 1.0 0.0)
           )
           "_non"
           (mapcar '* (vlax-curve-getendpoint enm) '(1.0 1.0 0.0))
         )
         (entdel enm)
       )
     )
   )
 )
 (setvar 'cmdecho 1)
 (vla-endundomark doc)
 (princ)
)

The procedure would be:

1. Switch to the WCS.

2. Substitute all (elliptical) arcs using c:Test.

3. Flatten all polylines.

4. Use the _Join command.

5. Some elements will not join to form closed polylines. This is due to inaccuracies.

Link to comment
Share on other sites

Your drawing is very peculiar. Not only are there undesirable 3D effects, the elliptical arcs all seem to have a major and minor radius that is almost equal (in other words: they are virtually circular).

 

With that in mind here is a function, similar to your suggestion, to create arc replacements in the Z=0 plane for both the arcs and the elliptical arcs:

(vl-load-com)

(defun c:Test  ( / enm idx ss)
 (setq doc (vla-get-activedocument (vlax-get-acad-object)))
 (vla-endundomark doc)
 (vla-startundomark doc)
 (setvar 'cmdecho 0)
 (if (setq ss (ssget '((0 . "ARC,ELLIPSE"))))
   (repeat (setq idx (sslength ss))
     (setq enm (ssname ss (setq idx (1- idx))))
     (if (not (vlax-curve-isclosed enm))
       (progn
         (command
           "_.arc"
           "_non"
           (mapcar '* (vlax-curve-getstartpoint enm) '(1.0 1.0 0.0))
           "_non"
           (mapcar
             '*            
             (vlax-curve-getpointatdist
               enm
               (* 0.5 (vlax-curve-getdistatparam enm (vlax-curve-getendparam enm)))
             )
             '(1.0 1.0 0.0)
           )
           "_non"
           (mapcar '* (vlax-curve-getendpoint enm) '(1.0 1.0 0.0))
         )
         (entdel enm)
       )
     )
   )
 )
 (setvar 'cmdecho 1)
 (vla-endundomark doc)
 (princ)
)

The procedure would be:

1. Switch to the WCS.

2. Substitute all (elliptical) arcs using c:Test.

3. Flatten all polylines.

4. Use the _Join command.

5. Some elements will not join to form closed polylines. This is due to inaccuracies.

 

Yep, that is what i said.

Thank you very much Roy. :D

But in my test drawing the ellip RED error. Why ?

Capture.jpg

Link to comment
Share on other sites

In BricsCAD this ellipse is replaced successfully. My guess is that the huge coordinates and the very small difference between the StartAngle and EndAngle are causing a problem in AutoCAD: The arc is almost a straight line. You can try improving the c:Test function to account for this specific case.

 

The BIG question is of course who or what process produced this cr*ppy drawing?:twisted:

Link to comment
Share on other sites

In BricsCAD this ellipse is replaced successfully. My guess is that the huge coordinates and the very small difference between the StartAngle and EndAngle are causing a problem in AutoCAD: The arc is almost a straight line. You can try improving the c:Test function to account for this specific case.

 

The BIG question is of course who or what process produced this cr*ppy drawing?:twisted:

 

Thanks for suggestion, Roy.

This drawing following from consultant. Crazy!

Xr-Pool.dwg

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