Introduction to Pterodactyl - live generate reports and documents with Grasshopper

Hello everyone :slight_smile: Recently I was working on new open-source plug-in for Grasshopper called Pterodactyl. You can generate nice looking documents and reports with it inside Grasshopper. Plug-in is avaliable on food4rhino for free (MIT License). Please let me know if you have any questions or suggestions :slight_smile: To open .md files download Typora.

1_0_0

Link to food4rhino download: https://www.food4rhino.com/app/pterodactyl
Link to youtube introduction to plugin: Introduction to Pterodactyl for Grasshopper - YouTube
Link to complete guide: Pterodactyl 1.0.0 Complete guide - YouTube

Let me know if you have any suggestions or questions here, or email me: w.radaczynski@gmail.com

Best regards :slight_smile:
wr

11 Likes

Hi.
I wouldn’t be interested in using it from GH, but from Visual Studio, have you given support to automate it at compiling time? For example, I would like to create templates and have my abstract classes fill them, is this possible?

Hey :slight_smile:

You can find here the source code: https://github.com/paireks/Pterodactyl

I did everything to divide Grasshopper functionality from other logic, so in “PterodacylEngine” you can see methods that will help you create reports without using Rhino, inside “PterodactylEngineTests” you will find unit tests, so you can treat them as documentation.

If you have any other questions or comments - let me know :slight_smile:

wr

I had taken one look at it in his day and it was very confusing. I don’t understand why you use classes to convert plain text to coded text for .md instead of using simple functions. There is too much padding that prevents me from understanding what is important. Having each class in different files or testing for each class doesn’t help either. It’s all too spread out for my laziness :innocent: So pls keep in mind that I don’t know your library yet.

I expected the classes to be of the type page, section, example, description… pre-cooked styles to easily compose from code. A page with a header, description and a paragraph should not carry more than three lines of code in my opinion, and even just one, since this format or page style looks like the basic one an could be a derived page class.

On the other hand, could you explain to me what you do with attributes (like [Theory], [ClassData(typeof(TestMathBlockHelper))?

Do you have some reference of .md codes?

Each class in “Pterodactyl” solution (that represents component in GH) corresponds to class in “PterodactylEngine”. Having each class in different file is standard practice. Testing every class that exists is also standard practice. So you think it’s better to do one class called for example “ReportCreator” and put all of the methods like AddHeadings, AddQuotes etc. inside it? I’d think about it, maybe it’s better solution. I’m not sure if it’ll work well in the long term, because I’m still adding new functionality, and having one giant class that has all of the methods may be not the best practice. If you have different experience with software architecture in developing Grasshopper plugins - please let me know, or show me some examples.

Creating header, description and a paragraph will take you, maybe not 3 lines of code, but not much more. For example if you want to create header:

Heading headingObject = new Heading("My heading", 1);
string myString = headingObject.Create();

Example above is literally inside PterodactylEngineTests in CheckReportCreator test method just like all of the other components, no need to bother with attributes. Those attributes just help me to parametrize all the tests, so there is no need to create method for each testing case, I can just create each case with one line like this then:

Add("Lol nice heading tho", 1, "# Lol nice heading tho");

Best regards,
wr

This is a standard procedure but for large projects or at least with medium complex wiring. If you develop a modular system it makes sense, if your system is sequential and very flat (no calls to other parts of the library)… I don’t see the need. I am personally against unit testing when developing plugins for GH, because the component itself works great as unit testers, doesn’t it? If you have several classes with the same behavior, where only one method changes, like a function that maps the input to the output, you can do the test all at once without losing anything, right?

I’d make a generic main class, like page class, that would do everything, without compositional intention. This contains the methods to add the content in .md with many default parameteres like justification or color. Maybe include some abstract method to define the composition. And inheriting this, classes with intention, like report, documentation, example, about, cover, index… different types of pages, with constructors that allow you to do everything in one line of code for your standard styles. I think this is more scalable, because to add more functionality, you only have to add one function instead of a whole class.

Another approach if you don’t want a giant class (which I don’t think there is going to be that big, I don’t think there are much more than 50 different codes), you can do it in a static way, using a main static class and having internal static classes to group the different methods depending on what they do. This way using intellisense you can navigate to what you’re looking for instead of looking at a flat list of methods.

In my opinion this approach is leaving not only the composition to the developer, but also the management of it. What matters is the global final result, the call to Create and the .md text concatenation can be automated, isn’t it?

Have you considered the StringBuilder class as a reference?

This project is not large yet, because it’s first release with basic functionality. It’s not complete full project that will never grow. This week for example I’m working on components for math graphs, which is completely something different, and it’s not related that much with Markdown language. So whole project will be probably 2x bigger. And I hope it will grow, so argument like “this and that is for medium project, but you don’t have to do it when your project is small” I’d much rather create good foundation from the start.

Strongly disagree. It’s really important to unit test basically everything you code, without exceptions in my opinion. How do you want to check test coverage or do TDD without it? It’s pretty interesting, because I’ve never seen before someone saying he is against unit testing, most of programmers don’t do it because they’re just too lazy, so they think that doing it manually will be enough, which is not if you want to constantly refactor, clean and add new code.

I agree with the rest of your post, I’ll definitely look at it, and see if it works better (it probably would). This is an open-source project so if you want to contribute - I strongly encourage you :slight_smile:

My current project (Peacock) has 8000 lines of code and is far from finished (but maybe it’s 20% less because there are many versions of the same things, it’s not clean and there’s a lot of experimental stuff). But it is big and I don’t need the unit tests because I put each functionality in a component or in a rh command and I debug it. GH’s plugin already isolates the code into controllable units, no other layer is needed for almost all cases, it’s already within the architecture of a nodal software. If you make a mobile application or a website, where you have no record of the internal processes, then it makes sense to branch out into a testing project. But GH is an algorithmic editor, every step of the process is already under control. In addition, the VS debug session traces the code calls so that when an exception occurs, you can see its path. I’m not saying it’s not important, I’m saying you get the same thing from the components, is redundant.

What I do need is to automate the documentation. The project will be on Github so I had already considered using .md as a format. But I would like to be able to export it to html as well. I started using the xml code tags but I really disliked it and stopped. But I left a door open, an abstract class from which all the others inherit, to which I can include an abstract method so that each class has to implement the documentation, that I can partially automate because all my classes already implement a description class. If it fits with my needs I will probably contribute in the future.

New 1.1.0 Pterodactyl version released with new components:
2020-05-31_02h45_22

Now you can create line graphs:

Point graphs:

Or bar charts:

And then add them to your reports that can be exported to .pdf, .html, LaTeX, .docx etc.

Video with new features: https://www.youtube.com/watch?v=13Dc9pHJ7gM

4 Likes

hi @w.radaczynski just wanted so say thanks for making this available. It works really well. The generated tables look really nice.
I was wondering why it is not possible to add text to the graphs, just like with the bars?
Also I would like if you could make the bars vertical.
When there are multiple bars (more than in your example) the bars become very narrow, making the text run over the colored bar. This doesn’t look very nice. Maybe you can adjust the image height based on the amount of data instead?
If possible I would like the option of the text to float above the bar (if you can add a vertical bar version)

1 Like

Hello
Thank you :slight_smile:

I was wondering why it is not possible to add text to the graphs, just like with the bars?

Do you need to put the text inside math graph? I can add it in 1.2.0.

Also I would like if you could make the bars vertical.

I can add it in 1.2.0. too. Basically I’ll work on a new version of Pterodactyl in July, because this month I work on different plugin. If you have more ideas: feel free to post it here :wink:

New Pterodactyl update: 1.2.0 :slight_smile:

new features:

Also, there is a manual in .pdf file inside the downloaded file (from food4rhino) :wink:

1 Like

Hei,

i downloaded the plugin according to the guide and plugins are giving error.
“1. Solution exception:Could not load file or assembly ‘PterodactylEngine, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. The system cannot find the file specified.”


Any solution?

Hey, unblock all .gha AND .dll files.