TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: TopoWAR 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 !!!
;; ("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 "")
)
-
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:
(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 "")
-
Alternatively:
(apply 'command (append '("_.pline") data1 '("")))
Beware of Object Snaps.
-
Could one use polar and entmake the pline?
-
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)
-
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
-
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.
-
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\""