Page 1 of 1

create a free hand curve

Posted: Wed Jul 20, 2016 8:45 pm
by Da_Elf
when i create a graphic i want to make sure the graphic is a free hand curve so i can add some points to it. how do i go about doing this?

Re: create a free hand curve

Posted: Wed Jul 20, 2016 8:55 pm
by Klaus
Hi Da_Elf,

you mean by script? This:
...
set the style of the templategraphic to "curve"
## Optional:
## set the points of the templategraphic to list_of_points
create graphic
reset the templategraphic
...
should do the trick.


Best

Klaus

Re: create a free hand curve

Posted: Wed Jul 20, 2016 9:09 pm
by [-hh]

Code: Select all

on mouseUp
  put "poly6" into gn
  if there is no grc gn then create grc gn
  set style of grc gn to "polygon" # <----------
  set points of grc gn to iAmAHexagon()
  set loc of grc gn to 200,200 -- loc is 230,230
end mouseUp

function iAmAHexagon
  return  "230,130" &cr& "317,180" &cr& \
    "317,280" &cr& "230,330" &cr& \
    "143,280" &cr& "143,180" &cr& "230,130"
end iAmAHexagon
Edit. Sorry Klaus, it's now a double answer. Had a phone break while writing.

Re: create a free hand curve

Posted: Wed Jul 20, 2016 10:23 pm
by dunbarx
Hi.

Note that early on, only certain vector graphic objects had a "points" property. But now many more (all?) do, with a new property, the "effective points".

Craig Newman

Re: create a free hand curve

Posted: Wed Jul 20, 2016 11:29 pm
by Da_Elf
i just created one and hit it for when i need it. would be good to create by type like
create grc "thisone" by type "free hand curve"

Re: create a free hand curve

Posted: Wed Jul 20, 2016 11:52 pm
by [-hh]
Hi all.
@Da_Elf
"Free hand curve" is presumably not a style rather a description, the style is "polygon".
Your "Create by type" is alike what Klaus said with using the templategraphic. You could also have several "prototypes" and then clone one of these.

@Craig
You can't *set* the effective points (Da_Elf wishes to set points) ...

[Edit. Replaced the incorrect "type" by "style"]

Re: create a free hand curve

Posted: Thu Jul 21, 2016 12:30 am
by Da_Elf
freehand.JPG
freehand is a type

now all i need to do is make an object move along the path

Re: create a free hand curve

Posted: Thu Jul 21, 2016 1:03 am
by [-hh]
That's because you set in the preferences: Property labels are "Description of option".
So you can choose this description as "style" in the property editor.
But try to set this style by script:

Code: Select all

set style of grc 1 to "freehand" -- yields the default, usually a rectangle
Why don't you ask for the style?

Code: Select all

answer the style of grc 1
Instead of "polygon" you may also use "curve" which is a polygon that has no marker properties.

p.s You don't need to create a graphic in order to move an object along points.
You can simply make a list myList of points (x1,y1) & cr & (x2,y2) ... and then

Code: Select all

 move <object> to myList

Re: create a free hand curve

Posted: Fri Jul 22, 2016 7:59 am
by richmond62