By Illustrator SDK, how to know if a selected art object is blend type? - adobe

In Adobe Illustrator, just draw a rectangle and a circle, then give them different colors. Choose AI menu "Object | Blend | Make", before this step you could open "Blend Options..." to set "Specified steps" to an integer. Now you get a series of arts. Using Direct Select Tool you can select the rectangle or circle you drawed at first.
My question is, how to write code to know if the art object you selected is one part of the blended series? Is there any useful suite in SDK? I have looked into the document but cannot find a proper API to get the infomation in AIArtSuite. (for CS5 & CS6)
Cound anyone help me, thanks in advance.

A Blend Object should be registered as a PlugInObject, at least in the JSX documentation(pdf link).
You can try something hacky like this in JSX(javascript):
#target illustrator
var doc = app.activeDocument;
var sel = doc.selection;
if(sel.length) alert("is part of blend: " + sel[0].parent.parent.typename == "PluginItem");
with an object that is part of a blend selected.
The assumption is the selected object has at least 2 parents: the Group and Blend PlugInItem, but it's not exact. I'm hoping other more exact answers will pop up.

Related

How To Change The Friction On A Box Collider 2D

I am trying to change the friction on my box collider 2d but the option in the inspector is grey so I can't change it from there so I made this code:
private BoxCollider2D bc;
bc = GetComponent<BoxCollider2D>();
bc.friction = 0;
When I open it in Unity I get this error:
Error CS0200: Property or indexer 'Collider2D.friction' cannot be assigned to -- it is read only
Does anybody know how I can circumvent this?
Any help is appreciated, thank you in advance!
This post and this post has a workaround for your question.
But you could just add a RigidBody 2D on your gameobject, then create a Physics Material 2D for it, which you can easily edit without writing any code at all.
Be sure the components have 2D at the end of their name or else you'll be adding 3D versions :D

Create floating button to add/subtract values to/from cells in spread sheet

To simplify data entry in the field, i.e. using tablets, I would like to create buttons in a spread sheet that will add or subtract values to or from the selected cell. Using spin buttons is not an option, as I would have to add hundreds of these buttons. This answer shows exactly what I'm looking for, i.e. a single set of floating buttons that will move relative to the selected cell.
Unfortunately, VBA-macros will not run in an android environment, so I need to find a solution in a StarBasic based software, e.g. LibreOffice. I'm aware that questions related to porting VBA to SB are not very popular, but my programming experience is solely limited to R and I'm at a loss on how to solve this. I've boiled down the VBA-code to the bare essentials:
Sub Worksheet_SelectionChange(ByVal Target As Range)
With ActiveSheet.CommandButton
.Left = Target.Offset(, 2).Left
.Top = Target.Offset(0).Top
End With
End Sub
Sub CommandButton_Click()
ActiveCell.Value = ActiveCell.Value + 1
End Sub
Any help in porting, or creating a new SB-macro from scratch will be much (!) appreciated.
I still ask you to try the scrollbar again. Just please change your attitude to it - take it not as a control, in which you need to move the slider to the right and left, but as a set of four buttons. Don't move, just tap
In my example, the properties of the control "Large change" set to 10, this is the default. You can change this to 5.
My macro has Const MAX_STEP = 20. You can change this to 10.
And you get buttons to only having +/- 1, +/- 5 and +/- 10
If the size of the control is not large enough to get into the necessary parts with your finger, then change the oSBar.setSize() in the code to your liking. Or just increase the zoom of the leaf, as I did when I was recording the GIF.

How to delete area of polygons that overlap?

I am trying to take a single layer of polygon buffers and delete the areas in which these circular buffers overlap (or intersect... I am not sure about the correct terminology here). I have so far tried the Intersection tool and Symmetrical difference tool, but these requires two layer inputs, and I am just working with a single layer. How can I accomplish this? I am working in QGIS.
Here is what I am working with:
I simply want to select and delete the areas where these circles overlap. I have searched this extensively online, but cannot find a solution that works for me, since I am only working with one layer.
you can try select by location analysis, if select "Where the feature" condition "Overlap", it select just overlap features.enter image description here
And delete after.
You can perform SQL Query with Execute SQL tool [
https://docs.qgis.org/3.16/en/docs/user_manual/processing_algs/qgis/vectorgeneral.html#id85]
Where Additional input datasources is your circle layer, that must have unique value, in my example attribute is called fid
Query is:
select c1.fid as fid1, c2.fid as fid2, intersection(c1.geometry,c2.geometry) as geometry
from input1 as c1, input1 as c2
where c1.fid > c2.fid and st_intersects(c1.geometry,c2.geometry)
query result is intersaction between geometries:
aftert that you can do symmetrical difference to optain
There is a new QGis plugin named "Buffer Without Overlaps" that works fine!

python-docx get words position and attributes

I'm looking for a means to extract the position (x, y) and attributes (font / size) of every word in a document.
From the python-docx docs, I know that :
Conceptually, Word documents have two layers, a text layer and a
drawing layer. In the text layer, text objects are flowed from left to
right and from top to bottom, starting a new page when the prior one
is filled. In the drawing layer, drawing objects, called shapes, are
placed at arbitrary positions. These are sometimes referred to as
floating shapes.
A picture is a shape that can appear in either the text or drawing layer. When it appears in the text layer it is called an inline shape,
or more specifically, an inline picture.
[...] At the time of writing, python-docx only supports inline pictures.
Yet, even if it is not the gist of it, I'm wondering if something similar exists :
from docx import Document
main_file = Document("/tmp/file.docx")
for paragraph in main_file.paragraphs:
for word in paragraph.text: # <= Non-existing (yet wished) functionnalities, IMHO
print(word.x, word.y) # <= Non-existing (yet wished) functionnalities, IMHO
Does somebody has an idea ?
Best,
Arthur
for word in paragraph.text: # <= Non-existing (yet wished) functionalities, IMHO
This functionality is provided right in the Python library as str.split(). These can be composed easily as:
for word in paragraph.text.split():
...
Regarding
print(word.x, word.y) # <= Non-existing (yet wished) functionnalities, IMHO
I think it's safe to say this functionality will never appear in python-docx, and if it did it could not look like this.
What such a feature would be doing is asking the page renderer for the location at which the renderer was going to place those characters. python-docx has no rendering engine (because it does not render documents); it is simply a fancy XML editor that selectively modifies XML files in the WordprocessingML vocabulary.
It may be possible to get these values from Word itself, because Word does have a rendering engine (which it uses for screen display and printing).
If there was such a function, I expect it would take a paragraph and a character offset within that paragraph, or something more along those lines, like document.position(paragraph, offset=42) or perhaps paragraph.position(offset=42).

Plotting a transition map in Gnuplot 4.6 (or other softwares?)

Goodmorning everybody,
I searched in the web for this problem for something like an hour an nobody seemed to have my same difficulty, so here I am. I'll explain you my problem: I have four states (but in future they can become much more the four) A, B, C and D between which a particle can do transitions. Suppose I know exactly how many times the particle undergoes the A->B, B->C, C->D, A->C (... and so on) transitions. I want to represent my states as dots on a circle and the transitions as arrows between states, which are wider (the arrows, not the dots!) proportionally to the number of transitions. I hope I made myself clear. Is this possible on Gnuplot 4.6? Otherwise: do you know other programs able to do that? Because I saw maps like this before, but sincerly I don't even know how to search for them!!
Thank you very much for your help.
A much more suitable tool for your problem would be Graphviz. You can use the Graphviz “DOT” language to express your transition map directly, and then use the Graphviz tools to perform various types of automated layout (including circular ones) and to produce image files showing the nodes and edges in the graph. If none of the automated layouts are what you want, you can compute them yourself and set the positions explicitly, and still use graphviz's renderer.

Resources