How to free rotate an object programmatically?

Discussion about writing code for Inkscape.
wyatt121
Posts: 10
Joined: Wed Jan 03, 2018 8:15 am

How to free rotate an object programmatically?

Postby wyatt121 » Mon Jul 09, 2018 5:42 pm

Hi,

I am trying to rotate an object X degrees. I would like to use the command line interface, but I only see ObjectRotate90, ObjectRotate90CCW. In addition, it is my understanding that I can't pass values through verbs. So I couldn't even do FreeRotate=X even if this verb existed...

Does anybody have an idea how I can free rotate an object? Is it possible to pass values through an extension via a command line? I'm assuming this is impossible also since I will still need to use a verb and can't pass values through verbs.

What's up with "Inkscape Dbus"? Is this API useable? http://ryanlerch.org/inkscape-dbus-documentation/

Inkscape is so amazing. I just wish I could send/receive values from verbs or an API. This would make it 100x more powerful for programming.

Any help is much appreciated.

Regards,

Wyatt

Moini
Posts: 2843
Joined: Mon Oct 05, 2015 10:44 am

Re: How to free rotate an object programmatically?

Postby Moini » Sat Jul 14, 2018 9:43 am

Mmh, I've never seen that article. I have no idea what the current status is, but my gut feeling is that it's probably not going to be in a workable state. You could ask about it on the developer mailing list, if you want to get more qualified answers to that question.

Currently, you would need to use an extension to achieve that rotation from command line (Inkscape provides ready-made functions for it in 'module' files for extensions (simpletransform)). Passing values to extensions from the command line does not work yet, though. You could load the values from a file, if that would be an option. For example, the Inkscape Generator extension does that.
Note that if you are running an extension, you cannot suppress the Inkscape GUI.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

wyatt121
Posts: 10
Joined: Wed Jan 03, 2018 8:15 am

Re: How to free rotate an object programmatically?

Postby wyatt121 » Thu Jul 26, 2018 7:41 am

Hi Moini,

Thank you for your reply. How would I load the values from a file via command line to pass to the transform function? I don't see any Inkscape documentation for this procedure.

Wyatt

Moini
Posts: 2843
Joined: Mon Oct 05, 2015 10:44 am

Re: How to free rotate an object programmatically?

Postby Moini » Thu Jul 26, 2018 9:50 am

I meant that you would need to write that extension.

Although, I have just learned of an extension that might be able to do exactly that, if you make it add transform attributes. Rotation shouldn't cause any problems (hopefully), in contrast to moving/scaling etc.

viewtopic.php?f=11&t=33895#p105491

But as far as I understand, the extension creates new images in the file, so you'd probably need to combine bits from various extensions to really get the result you need.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests