Author Topic: Change the diameter of the circle  (Read 3271 times)

0 Members and 1 Guest are viewing this topic.

myloveflyer

  • Newt
  • Posts: 152
Change the diameter of the circle
« on: August 12, 2019, 11:30:04 PM »
Code: [Select]
;;;by roy_043
(defun KGA_Conv_Pickset_To_ObjectList (ss / i ret)
  (if ss
    (repeat (setq i (sslength ss))
      (setq ret (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) ret))
    )
  )
)
 
(defun c:Test ( / cen cirLst doc linLst radNew radOld ss)
  (setq doc (vla-get-activedocument (vlax-get-acad-object)))
  (vla-endundomark doc)
  (vla-startundomark doc)
  (if
    (and
      (setq ss (ssget '((0 . "LINE,CIRCLE"))))
      (setq radNew (getreal "\nNew radius: "))
    )
    (progn
      (foreach obj (KGA_Conv_Pickset_To_ObjectList ss)
        (if (= "AcDbLine" (vla-get-objectname obj))
          (setq linLst
            (vl-list*
              (list (vlax-get obj 'startpoint) T obj)
              (list (vlax-get obj 'endpoint) nil obj)
              linLst
            )
          )
          (setq cirLst (cons obj cirLst))
        )
      )
      (foreach cir cirLst
        (setq cen (vlax-get cir 'center))
        (setq radOld (vla-get-radius cir))
        (vla-put-radius cir radNew)
        (foreach sub linLst
          (if (equal radOld (distance cen (car sub)) 1e-8)
            (progn
              (vlax-put
                (caddr sub)
                (if (cadr sub) 'startpoint 'endpoint)
                (vlax-curve-getclosestpointto cir (car sub))
              )
              (setq linLst (vl-remove sub linLst))
            )
          )
        )
      )
    )
  )
  (vla-endundomark doc)
  (princ)
)
This app was written by a friend of the forum. The program now has a problem by changing the diameter of the circle to lengthen or shorten the length of the line between the circles. It is not dealing with slashes. I am not familiar with the VLAX feature. Which friend can help me solve this problem? thank you for your help!
« Last Edit: August 13, 2019, 03:18:41 AM by myloveflyer »
Never give up !

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Change the diameter of the circle
« Reply #1 on: August 13, 2019, 02:55:33 AM »
There are significant inaccuracies in the drawing. Change 1e-8 to 1e-2.

Code: [Select]
(Tpst_Software_UseLimit)
It seems you are selling the code that was donated to you. Food for thought...

Original topic:
https://www.theswamp.org/index.php?topic=55199.0
« Last Edit: August 13, 2019, 03:00:55 AM by roy_043 »

myloveflyer

  • Newt
  • Posts: 152
Re: Change the diameter of the circle
« Reply #2 on: August 13, 2019, 03:26:42 AM »
There are significant inaccuracies in the drawing. Change 1e-8 to 1e-2.

Code: [Select]
(Tpst_Software_UseLimit)
It seems you are selling the code that was donated to you. Food for thought...

Original topic:
https://www.theswamp.org/index.php?topic=55199.0
Thanks,Roy!
This precision is to control the diameter of the circle. Is the accuracy in the drawing too low?
(Tpst_Software_UseLimit) This is the instructions for other users to run this program. :2funny:
« Last Edit: August 13, 2019, 03:32:27 AM by myloveflyer »
Never give up !

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Change the diameter of the circle
« Reply #3 on: August 13, 2019, 03:47:18 AM »
This precision is to control the diameter of the circle.
No. The tolerance is used to determine if line points lie on the circle.
Is the accuracy in the drawing too low?
Certainly too low for a CAD drawing.

Please start a new topic for your other problem.

myloveflyer

  • Newt
  • Posts: 152
Re: Change the diameter of the circle
« Reply #4 on: August 13, 2019, 03:55:30 AM »
This precision is to control the diameter of the circle.
No. The tolerance is used to determine if line points lie on the circle.
Is the accuracy in the drawing too low?
Certainly too low for a CAD drawing.

Please start a new topic for your other problem.
OK,Roy!
I will open another title.
Never give up !

myloveflyer

  • Newt
  • Posts: 152
Re: Change the diameter of the circle
« Reply #5 on: August 13, 2019, 04:17:04 AM »
Quote
Certainly too low for a CAD drawing.
This drawing is out of other calculation software, so the drawing of different calculation software may not be the same as the precision control. I will pay attention to this later. Thank you Roy, you have helped me a lot!
Never give up !