TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Fabricio28 on February 24, 2021, 02:39:20 PM
-
Hi,
How are you?
I'm trying to find a lisp to create a point to 1x1 from specific point.
Anybody could help me please?
Thanks
Fabricio
-
One way with the use of polar function.
-
-
Perhaps a bit more so X & Y can vary, could add default values if do all the time or as per image.
(defun c:test ( / p )
(setq xy (list (getreal "\nEnter x ") (getreal "\nEnter Y ")))
(if (setq p (getpoint "\nSpecify point: "))
(entmake (list '(0 . "POINT") (cons 10 (trans (mapcar '+ p xy) 1 0))))
)
(princ)
)
(http://)
-
One way with the use of polar function.
Thank you very much!!!!
-
Mr. Lee Mac
Fantastic!! thanks!!
-
Perhaps a bit more so X & Y can vary, could add default values if do all the time or as per image.
(defun c:test ( / p )
(setq xy (list (getreal "\nEnter x ") (getreal "\nEnter Y ")))
(if (setq p (getpoint "\nSpecify point: "))
(entmake (list '(0 . "POINT") (cons 10 (trans (mapcar '+ p xy) 1 0))))
)
(princ)
)
(http://)
It is very nice!!
input the distance before!! Thanks
-
Hi guys
How are you?
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:
Anybody could help me please?
Thanks
Fabricio
-
-
Thank you very much for replay
But I have many situation to insert this point. Unfortunately not a default.
maybe if I set the measure x and y (negative or positive) will be great!
Could you help me please?
Thanks
-
If you have the list of coordinates then you can iterate through each point with angle and distance as I did in my last reply.
-
If you have the list of coordinates then you can iterate through each point with angle and distance as I did in my last reply.
Sorry if I don't understand what you meant, but I don't have a list of the coordinates. I'm inserting it manually.
Regards
-
If so then you can specify the angle in the routine as indicated in the codes below and change it to suit yours.
(setq g
(* pi
0.25)) ;; = 45 Degree )
)
)
)
-
If so then you can specify the angle in the routine as indicated in the codes below and change it to suit yours.
(setq g
(* pi
0.25)) ;; = 45 Degree )
)
)
)
Great!! Thank very much!!
When I changed the angle worked fine!!
Regards
-
You're welcome anytime.
Good luck with your work.
-
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.
-
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.
; 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]
-
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.
; 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