Go Back   AC3D Forums > Resources > AC3D Tutorials and How-To's
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 20th January 2010, 01:04 PM   #1
pascaldl
Junior Member
Junior member
 
Join Date: Jan 2010
Posts: 2
Default Not yet a user ... Is it possible to 'script' and object ?

I dont know if 'script' means my 'goal'.

I enjoy Graphical User Interface (GUI) and it is nice to use a mouse to sculpt something. I want to build very 'mathematical objects' like, simple example, cube inside a cube to have a 4D cube in real 3D world .. Hope you follow me. And also, at each top I want a nice sphere (a bit like the well knowned (I hope) Atomium in Bruxelles : http://fr.wikipedia.org/wiki/Atomium )... still with me ?

Is there a way to describe this object : something like
Cylinder1 is Cyl(10, 1, 1, 1)
Move cylinder to (a, b, c)
Rotate it according to (u, v, w) (a normalized vector)
Sphere1 is Sphere(1, 1, 1)
Sphere2 is Sphere(0.9, 0.9, 0.9)
MySphere = Spher1 - Sphere2
....
Sizing, duplicate ...

then give a name to that object

and use it thru AC3D

... that's it

I my mind : the object i want is a bit more complexe so the scripting language may have for, if then else, while and must know some trigonometrics

regards Pascal
pascaldl is offline   Reply With Quote
Old 20th January 2010, 04:24 PM   #2
lisa
Senior Member
Professional user
 
lisa's Avatar
 
Join Date: Mar 2005
Location: Phoenix, AZ
Posts: 917
Default Re: Not yet a user ... Is it possible to 'script' and object ?

AC3D has several different scripting options.

AC3D supports both C-language plugins as well as TCL scripts. If you know the mathematics for the shape you want to create, you can write a plugin or script to generate it.

It's also possible to send commands to AC3D from an external program using the TCP\IP socket interface. If you go into the main settings, click on the advanced tab, then enabled "Allow Socket Commands" you can now communicate with AC3D from other software you've written. For example, if you have telnet, try "telnet localhost 1655" then type "ac3d list". This will dump a list of all the commands. If you write support and ask for the SDK, I believe the SDK includes an example TCL shell and example Java shell.
lisa is offline   Reply With Quote
Old 20th January 2010, 04:43 PM   #3
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,563
Default Re: Not yet a user ... Is it possible to 'script' and object ?

Lisa beat me to it

Here's a sample script which makes 10 cubes and positions them in a line.

Code:
set c [ac3d list]

set x 0.0
for { set i 1 } { $i <= 10 } { incr i } {
    set ob [ac3d new_cube]
    ac3d object_select $ob
    ac3d scale 0.2 0.2 0.2
    ac3d move_to $x 0 0
    ac3d clear_selection
    set x [expr $x + 0.3]
}
Here is some code to display all the AC3D internal script commands:

Code:
toplevel .test
text .test.t
.test.t insert end $c
pack .test.t -fill both
If you put either of these in a file called something.tcl in the scripts folder, AC3D will run the script when it starts. You could also send the commands to AC3D as Lisa mentions.
Andy is offline   Reply With Quote
Old 21st January 2010, 01:38 PM   #4
pascaldl
Junior Member
Junior member
 
Join Date: Jan 2010
Posts: 2
Default Re: Not yet a user ... Is it possible to 'script' and object ?

Merci Lisa et Andy

First step : I made a tiny 'BlaBla.TCL' file with Andy's example and put it in the scripts forlder. Exactly as described when launching AC3D the script start and i receive a nice 'ten cubes' serie. ... Good point.
Now I want to add other elements to that new 'object'.
Do I have to stop AC3D, edit 'Bla bla.TCL' file, add some new lines, save, then relaunch AC3D ? Is there a way to stay in AC3D, and relauch the script ?
Hope the answer is yes
Many thanks in advance for quick, precise and precious (for me) help
Pascal
pascaldl is offline   Reply With Quote
Old 21st January 2010, 01:55 PM   #5
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,563
Default Re: Not yet a user ... Is it possible to 'script' and object ?

I think the only object you can make in a script is a cube but you can also load any object from a script line and then reposition that in a similar way - see the list of commands that come back from an 'ac3d list' command.

If you can write plugins you can add your own commands which can then be used from scripts.

Look into tcl/tk - that's what AC3D uses for scripting. You could make a UI where you enter scripts and a button which will execute the code. Alternatively, you can send commands to AC3D via a socket.

If you don't know tcl/tk, you could always use your favourite scripting language to generate AC3D files. The format is pretty simple.
Andy is offline   Reply With Quote
Reply

Tags
atomium, hypercube, procedural, scripting

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 12:31 PM.


AC3D Forum
(C) Inivis Limited 2020