Author Topic: How to change normal Z of a center of circle in Autocad?  (Read 650 times)

0 Members and 1 Guest are viewing this topic.

Vikram

  • Newt
  • Posts: 42
How to change normal Z of a center of circle in Autocad?
« on: December 27, 2019, 02:00:36 AM »
I have a drawing in which "normal Z" of the center of circles is -1. Thats why the coordinates became negative in ASCII dxf format text file. I want to change the normal Z to 1.
Note:  There difference between Normal Z and Center Z. We get normal Z for only circles.
I was able o change the the Z coordinate to 0 but the normal Z is still -1.
Format is like Normal X=0 Normal Y=0 and Normal Z=-1

I did elevating Z to 0. Tried changing UCS to world but not helping/ I have attached the sample drawing for reference. Any auotlisp will also help!
« Last Edit: December 27, 2019, 02:44:04 AM by Vikram »

roy_043

  • Water Moccasin
  • Posts: 1804
  • BricsCAD 18
Re: How to change normal Z of a center of circle in Autocad?
« Reply #1 on: December 27, 2019, 04:18:48 AM »
Try:
Code - Auto/Visual Lisp: [Select]
  1.  
  2. (defun KGA_Conv_Pickset_To_ObjectList (ss / i ret)
  3.   (if ss
  4.     (repeat (setq i (sslength ss))
  5.       (setq ret (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) ret))
  6.     )
  7.   )
  8. )
  9.  
  10. (defun c:CorrectNormals ( / doc ss)
  11.   (if (setq ss (ssget "_X" '((0 . "CIRCLE") (210 0.0 0.0 -1.0))))
  12.     (foreach obj (KGA_Conv_Pickset_To_ObjectList ss)
  13.       (vlax-put obj 'normal '(0.0 0.0 1.0))
  14.     )
  15.   )
  16.   (princ)
  17. )

EDIT: added (vl-load-com).
« Last Edit: December 27, 2019, 06:32:02 AM by roy_043 »

Vikram

  • Newt
  • Posts: 42
Re: How to change normal Z of a center of circle in Autocad?
« Reply #2 on: December 27, 2019, 04:43:48 AM »
Thanks for the lisp! But unfortunately I'm using Intellicad and its is throwing me the error of "Bad argument Type"

snownut2

  • Swamp Rat
  • Posts: 970
  • Bricscad 20 Ultimate
Re: How to change normal Z of a center of circle in Autocad?
« Reply #3 on: December 27, 2019, 06:14:56 AM »
The subject title says you are looking for AutoCAD help? 

Lee Mac

  • Seagull
  • Posts: 12390
  • London, England
Re: How to change normal Z of a center of circle in Autocad?
« Reply #4 on: December 27, 2019, 06:19:29 AM »
Assuming that you don't want the visual position of the circles to change, I would suggest the following:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:test ( / c i n s x )
  2.     (if (setq s (ssget "_X" '((0 . "CIRCLE") (210 0.0 0.0 -1.0))))
  3.         (repeat (setq i (sslength s))
  4.             (setq i (1- i)
  5.                   x (entget (ssname s i))
  6.                   n (assoc 210 x)
  7.                   c (assoc 010 x)
  8.             )
  9.             (entmod (subst (cons 10 (trans (cdr c) (cdr n) 0)) c (subst '(210 0.0 0.0 1.0) n x)))
  10.         )
  11.     )
  12.     (princ)
  13. )

roy_043

  • Water Moccasin
  • Posts: 1804
  • BricsCAD 18
Re: How to change normal Z of a center of circle in Autocad?
« Reply #5 on: December 27, 2019, 06:28:02 AM »
@Vikram:
Is there an online overview of the Lisp functions and features supported by IntelliCAD?

@Lee Mac:
I also considered translating the center point but in this situation it appears to not be required.

Vikram

  • Newt
  • Posts: 42
Re: How to change normal Z of a center of circle in Autocad?
« Reply #6 on: December 30, 2019, 05:42:13 AM »
Hey @Lee Mac it worked!
Thanks for the help!
If you want to see Intellicads lisp compatibility you can check here http://help.caddit.net/progecad.php?kb=IDR_LISP_B100

Again thanks for helping me! :)