Author Topic: problem with text - list  (Read 1910 times)

0 Members and 1 Guest are viewing this topic.

TopoWAR

  • Newt
  • Posts: 135
problem with text - list
« on: November 22, 2015, 07:40:08 PM »
Hi, I'm trying to make a polyline with this data but I can not pass "12.12 <342d17'0" to 12.12 <342d17'0, as I do, thank you !!!

Code: [Select]
;; ("12.12<342d17'0" "349.11<31d4'0" "25.00<102d57'0" "264.33<97d51'0" "26.96<9d9'0" "25.48<88d14'0")
(foreach TEMP lista_datos__real
    (command "_pline")
    (foreach TMP TEMP (command TMP))
    (command "")
  )
Thanks for help

ymg

  • Guest
Re: problem with text - list
« Reply #1 on: November 22, 2015, 08:27:08 PM »
Topowar,

Two problems, The format of your data must be "12.12<342d17'0\"" if you want to use seconds.

Alternatively, since your data is always 0"   it could be "12.12<342d17'"

For the code part, you are restarting the command pline at each iteration
use the following:

Code: [Select]
(setq data1  '("12.12<342d17'0\"" "349.11<31d4'0\"" "25.00<102d57'0\"" "264.33<97d51'0\"" "26.96<9d9'0\"" "25.48<88d14'0\""))
(setq data2  '("12.12<342d17'" "349.11<31d4'" "25.00<102d57'" "264.33<97d51'" "26.96<9d9'" "25.48<88d14'"))
(command "_PLINE")
   (foreach p data1
      (command p)
   )
(command "")

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: problem with text - list
« Reply #2 on: November 23, 2015, 05:24:20 AM »
Alternatively:
Code: [Select]
(apply 'command (append '("_.pline") data1 '("")))
Beware of Object Snaps.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: problem with text - list
« Reply #3 on: November 23, 2015, 07:30:24 AM »
Could one use polar and entmake the pline?
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.

TopoWAR

  • Newt
  • Posts: 135
Re: problem with text - list
« Reply #4 on: November 23, 2015, 11:18:52 AM »
Could one use polar and entmake the pline?

hello, as if I really take care data is close to the end, for example:
vertices of poly 1 2 3 4 5 6, and eventually occupied the angle and distance data between 6 and 1 (closing data)
Thanks for help

ymg

  • Guest
Re: problem with text - list
« Reply #5 on: November 23, 2015, 12:53:17 PM »
TopoWar,

I don't understand your last comment.

CAB's suggestion make sense as using command is kind of slow.

Where is your data coming from?

ymg

TopoWAR

  • Newt
  • Posts: 135
Re: problem with text - list
« Reply #6 on: November 23, 2015, 01:08:58 PM »
ok, I have the following data:
"12.12 <342d17'0" "349.11 <31d4'0" "25.00 <102d57'0"
with this data I create a polyline with vertices
"12.12 <342d17'0" 1-2
"349.11 <31d4'0" 2-3
"25.00 <102d57'0" 3-4

I occupy the data really is: angle and distance of:

4-1 angle ?? distance ??

although I think these data we can use "polar" or "angtos" do not know.
Thanks for help

ymg

  • Guest
Re: problem with text - list
« Reply #7 on: November 23, 2015, 08:45:24 PM »
TopoWar,

Doing this you are always starting your polyline at 0,0

In order to use polar you would need to parse your data
into an angle  and a distance.

(setq dist (atof str) )   will give you the distance
(setq ang (angtof (substr str (+ (vl-string-position 60 str) 2))) gives you the angle in radian.

So (polar p ang dist) gives you the point.

This will work in the angle value are direction (azimut)

If they are angle from the last point you will have to add pi
to every angle but the first.

Where does the data come from ?

Your data is still wrong, the second symbol " must be escaped
like so \" and then the final " to close the string.

"12.12 <342d17'0" should be "12.12 <342d17'0\""
« Last Edit: November 23, 2015, 09:08:14 PM by ymg »