OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Script and Marco Recording in OOdraw?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Draw
View previous topic :: View next topic  
Author Message
JeremyB
Guest





PostPosted: Wed Aug 27, 2003 8:18 am    Post subject: Script and Marco Recording in OOdraw? Reply with quote

I have been using OOdraw to create simple joinery shop drawings. It is quite useful, but to make it really rock I am going to need to learn and use the macro language.
To get my head around it would like to record macros and veiw them. I know 1.1 has macro recording for OOwriter and OOspread but not in OOdraw. Will this change?
Is there a way to record scripts and macros in OOdraw?

The kind of thing I would like to acheive is a macro that takes the height width and depth of a joinery carcass and plots the required board size rectangles with dimensions to the page to create a cutlist drawing.
Even being able to record the drawing of a component and the recall/repeat later would be tremendous. I use the gallery to store drawn components already but I would like to be able to automate the process between drawings.
Are these things acheivable? Will I have to learn this whole Java and API thing? How hard is this kind of programming?. What I have seen so far of the documentation seems fairly steep and scary.

Thanks
Jeremy B
Back to top
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Wed Aug 27, 2003 9:51 am    Post subject: Reply with quote

Quote:
The kind of thing I would like to acheive is a macro that takes the height width and depth of a joinery carcass and plots the required board size rectangles with dimensions to the page to create a cutlist drawing.

I'm not even sure I understand the problem description. Sorry.

If you want to see some non trivial macro code for Draw, then see my sig. below. Also see this....

http://kosh.datateamsys.com/~danny/OOo/Examples/

See the Bouncing Balls and the Calculator. These are programming examples in Draw, but are not useful tools of themselves.

I believe that you would not have any trouble reading my code. I do strive for clarity in my comments and choices of identifier names.

Quote:

Are these things acheivable?

Probably. It is only a question of effort to implement.

For example, I have in mind a more complex program to draw org. charts or other hierarchical charts, but I simply have not had time to implement it yet.


Quote:

Will I have to learn this whole Java and API thing?


Not necessarily. Basic is easy to learn and use. It has the added benefit that you can package up tools into a form that is easy for an end user to access. (See my sig. below for Danny's Draw Power Tools, or see the example programs linked to above.)

Basic on the other hand lacks such essential features as data structures, and recursion. So don't expect to do anything complex in Basic that requires more than simple iteration. Nonetheless, it is amazing what you can draw in Basic with just iteration. See Danny's Draw Power Tools.

Python is another alternative. It is not quite easy to setup at first. But it is rewarding once you do so. You can also replicate your setup on any other machine. For a tool you want to write for your own use, requiring non-trivial programming, Python has many advantages. But the big disadvantage is if you want to "deploy" the tool so that it is drop dead easy for an end user to get it and use it.

Java is sort of in-between on the deployment end. You can write a Java program that is deployable as a stand alone JAR file. Java has all of the powerful features to write complex programs, but its access is much more clumsy than Python's.

See my Maze Builder program for OOo Draw.

http://kosh.datateamsys.com/~danny/OOo/Java-OOo

Both the Python and Java approach a small amount of work for the user to get OOo to listen for a uno connection. (Unless you are writing a "Component", which has a higher still barrier to entry.) But one thing about this is that your Java or Python program can run on a different machine, even a different OS, than the OpenOffice.org program.

For instnace, see my Maze Builder described above. You could run it on any platform that has Java, such as Linux or Windows. Even a platform that does NOT have an actual OOo port. And the OOo could be running on a different computer, such as a Linux, Windows or Mac OS X computer. Then the other computer with the maze generator connects to the computer running OOo and causes it to draw a maze.

If you are on Windows, then there is another approach. You can use any language that can access OOo through its OLE bridge. For instance, I have programmed OOo Drawings from Microsoft Visual FoxPro. Others have used Visual Basic or Delphi.

The UNO api to OOo is the same, no matter which of the above paths you take. So although different languages have their tradeoffs, they all use the same underlying concepts of objects (i.e. services) and methods and properties to access OOo.


Quote:

How hard is this kind of programming?. What I have seen so far of the documentation seems fairly steep and scary.


How difficult you perceive it to be is a function of how experienced of a programmer you are.

The documentation is fairly steep. It can be learned There is nothing frightening in it however.. Having examples like I'm pointing you to can be helpful. You can get the benefit of someone else's struggles learning the documentation.

Search in OOoForum in the Macro's and API section. There have been questions asked before about how to get started with Macros. I and others have answered those questions. Some of those answers have a pointer to Andrew Pitonyak's macro information

http://www.pitonyak.org/oo.php

which is a valuable source of information, But be prepared for a lot of macros for Calc and Writer that aren't useful for making drawings. But useful stuff.

Hope this information is useful.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
JeremyB
Guest





PostPosted: Wed Aug 27, 2003 3:38 pm    Post subject: Thanks Reply with quote

DannyB
Thank you for your detailed advice. I'm a bit short of time, so reassurance is useful before committing to what for me could take a while. Hopefully I'll have some progress to report soon.

JeremyB
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Draw All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group