Author Topic: Making a polyline start on a specific angle  (Read 7957 times)

0 Members and 1 Guest are viewing this topic.

iliekater

  • Guest
Making a polyline start on a specific angle
« on: December 06, 2007, 02:45:17 PM »
I can easily start a polyline on a specific angle (or change it in any time) by simply using
Code: [Select]
<30for example on 30 degrees .
My Problem is that I can't do it with AutoLISP code . This problem haunted me for years , but I forgot about that until recently when I once again needed to do that .
Can anyone help me specify the angle with code ?

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Making a polyline start on a specific angle
« Reply #1 on: December 06, 2007, 02:51:50 PM »
Something like (setvar 'snapang angle) (setvar 'orthomode 1)....you can also use polar to get a point at angle at a specified distance.

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

iliekater

  • Guest
Re: Making a polyline start on a specific angle
« Reply #2 on: December 06, 2007, 04:46:36 PM »
Yes , but I don't the next point . I only know the starting point ; I want to let the user specify the points he desires (on a specific angle) . I'll ty tomorrow the snapang you adviced me . By the way : why you quote the variable's name ?

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Making a polyline start on a specific angle
« Reply #3 on: December 06, 2007, 04:51:18 PM »
Just personal preference...like it better than using (setvar "snapang" ang).

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Making a polyline start on a specific angle
« Reply #4 on: December 06, 2007, 09:55:15 PM »
Try this:
Code: [Select]
(defun c:test()
  (vl-cmdf "._pline" pause "<30" pause)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

DHOPP

  • Guest
Re: Making a polyline start on a specific angle
« Reply #5 on: December 10, 2007, 11:09:51 PM »
I have been messing with this (Cab helped me start this) anyway

Code: [Select]
(defun c:ga (/ ANG ANGVAR ORTHMODE PT1)
  (setq ang (getangle "\nStart angle?: ")
angvar (getvar 'snapang)
orthmode (getvar 'orthomode)
)
  (setq pt1 (getpoint "\nStart point: "))
  (setvar 'snapang ang)
  (setvar 'orthomode 1)
  (command "._pline"
   pause ang"" pt1
  )
  (setvar 'snapang angvar)
  (setvar 'orthomode orthmode)
  (princ)
)

It would be nice if I could go back and forth from previous angle to the angle I got when routine begins, or maybe I need to work mline into this with 90 degree endcaps...for another night I guess
« Last Edit: December 11, 2007, 02:42:12 PM by DHOPP »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Making a polyline start on a specific angle
« Reply #6 on: December 11, 2007, 12:09:11 AM »
Use the one Jeff gave you and replace "._line" with "._pline"
http://forums.augi.com/showpost.php?p=788852&postcount=2
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Making a polyline start on a specific angle
« Reply #7 on: December 11, 2007, 12:12:18 AM »
Here I'll help with the modifications:
How does this work?
Code: [Select]
(defun c:ga (/ ANG ANGVAR ORTHMODE PT1)
  (setq ang (getangle "\nStart angle?: ")
angvar (getvar 'snapang)
orthmode (getvar 'orthomode)
  )
  (setq pt1 (getpoint "\nStart point: "))
  (setvar 'snapang ang)
  (setvar 'orthomode 1)
  (command "._pline"
   pt1
   pause
  )
  (setvar 'snapang angvar)
  (setvar 'orthomode orthmode)
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Making a polyline start on a specific angle
« Reply #8 on: December 11, 2007, 10:01:22 AM »
I'm not sure how arbitrary the angles being used are...but it seems like turning polar tracking on and adding any additional angle increments would do the trick. :?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

DHOPP

  • Guest
Re: Making a polyline start on a specific angle
« Reply #9 on: December 11, 2007, 02:44:51 PM »
Here I'll help with the modifications:
How does this work?
Code: [Select]
(defun c:ga (/ ANG ANGVAR ORTHMODE PT1)
  (setq ang (getangle "\nStart angle?: ")
angvar (getvar 'snapang)
orthmode (getvar 'orthomode)
  )
  (setq pt1 (getpoint "\nStart point: "))
  (setvar 'snapang ang)
  (setvar 'orthomode 1)
  (command "._pline"
   pt1
   pause
  )
  (setvar 'snapang angvar)
  (setvar 'orthomode orthmode)
  (princ)
)

works better than mine, I was close....I learn a lot from you

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Making a polyline start on a specific angle
« Reply #10 on: December 11, 2007, 03:18:40 PM »
Glad to have helped & thanks to Jeff too.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

iliekater

  • Guest
Re: Making a polyline start on a specific angle
« Reply #11 on: December 12, 2007, 01:54:36 AM »
Thanks ronjonp , I played with the two system variables you suggested and I did it !  :-)
Now I will give it a try with CAB's code (vl-cmdf) .