Author Topic: Draw a point with especific distance  (Read 3286 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Draw a point with especific distance
« Reply #15 on: February 27, 2021, 05:53:28 AM »
There is not anything wrong about the code.

It is insert a point to x=1 and y=1. But in some case ins't working properly, just like the example bellow

Align your UCS with the surrounding geometry, and then use my program to calculate & create a point offset by 1,1 relative to the current UCS.

BIGAL

  • Swamp Rat
  • Posts: 1398
  • 40 + years of using Autocad
Re: Draw a point with especific distance
« Reply #16 on: February 27, 2021, 11:13:17 PM »
Following on from Lee's suggestion this is a roughy answer, it does depend on the end picked for +- y . You may need to look at what osnap settings need to be set no real dwg to test. Tested on lines. If picking plines must exit and redo as it depends on segment picked. Enter Enter not that hard.

Code: [Select]
; point at x y offset from line by AlanH Feb 2021

(defun c:test ( / pt xy )
(command "UCS" "World")
(setq xy (list  (getreal "\nEnter x ") (getreal "\nEnter Y ")))
(while (setq pt (getpoint "\nSpecify point: Enter to exit "))
(setq pt (list (car pt)(cadr pt) 0.0))
(command "UCS" "OB" pt)
(command "UCS" "Origin" (trans (list (car pt)(cadr pt) 0.0) 0 1))
(command "POINT" xy)
(command "UCS" "World")
)
(princ)
)
[code]
A man who never made a mistake never made anything

Fabricio28

  • Swamp Rat
  • Posts: 666
Re: Draw a point with especific distance
« Reply #17 on: March 02, 2021, 12:11:52 PM »
Following on from Lee's suggestion this is a roughy answer, it does depend on the end picked for +- y . You may need to look at what osnap settings need to be set no real dwg to test. Tested on lines. If picking plines must exit and redo as it depends on segment picked. Enter Enter not that hard.

Code: [Select]
; point at x y offset from line by AlanH Feb 2021

(defun c:test ( / pt xy )
(command "UCS" "World")
(setq xy (list  (getreal "\nEnter x ") (getreal "\nEnter Y ")))
(while (setq pt (getpoint "\nSpecify point: Enter to exit "))
(setq pt (list (car pt)(cadr pt) 0.0))
(command "UCS" "OB" pt)
(command "UCS" "Origin" (trans (list (car pt)(cadr pt) 0.0) 0 1))
(command "POINT" xy)
(command "UCS" "World")
)
(princ)
)
[code]

Sorry for delay to answer you, BIGAL.

I've tested the code and worked like a charm!!!

Thank you very much all of you guys for the support. It is save me a lot of time.

Regards
Fabricio