Skip to content

Conversation

@tomvanmele
Copy link
Member

@tomvanmele tomvanmele commented Sep 19, 2021

What type of change is this?

  • Bug fix in a backwards-compatible manner.
  • New feature in a backwards-compatible manner.
  • Breaking change: bug fix or new feature that involve incompatible API changes.
  • Other (e.g. doc update, configuration, etc)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I added a line to the CHANGELOG.md file in the Unreleased section under the most fitting heading (e.g. Added, Changed, Removed).
  • I ran all tests on my computer and it's all green (i.e. invoke test).
  • I ran lint on my computer and there are no errors (i.e. invoke lint).
  • I added new functions/classes and made them available on a second-level import, e.g. compas.datastructures.Mesh.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

@tomvanmele
Copy link
Member Author

Based on @gonzalocasas recipe for making nurbs functionality pluggable...

Added compas.artists.Artist and pluggable factory compas.artists.new_artist, and plugins compas_rhino.artists.new_artist_rhino and compas_blender.artists.new_artist_blender.

This enables artist instantiation without CAD-specific imports.

from compas.artists import Artist
from compas.datastructures import Mesh
from compas.geometry import Polyhedron

shape = Polyhedron.from_platonicsolid(12)
mesh = Mesh.from_shape(shape)

artist = Artist(mesh)
artist.draw()

print(type(artist))  # compas_rhino.artists.meshartist.MeshArtist (if executed in Rhino)
                     # compas_blender.artists.meshartist.MeshArtist (if executed in Blender)

Comment on lines +31 to +33
@staticmethod
def draw_collection(collection):
raise NotImplementedError
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused why this is on the base Artist and not on the BlenderArtist.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha perhaps the name is confusing. was mean to be a static method to draw many objects at the same time. is not related to the "collection" of blender. but since there is no implementation for it anywhere, perhaps it can just be removed...

Copy link
Member Author

@tomvanmele tomvanmele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha, apparently, because i am the original author of the PR i can't approve the changes, since "pull request authors cannot approve their own pull requests" :)

@tomvanmele
Copy link
Member Author

i guess @gonzalocasas this means that you will have to approve of yourself :)

Copy link
Member

@beverlylytle beverlylytle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I come to save the day!

@tomvanmele
Copy link
Member Author

merging still blocked since @gonzalocasas requested changes at some point...

@gonzalocasas
Copy link
Member

how picky this thing gets! ;)
I approved the changes, but I could add the missing shape artists to this before we merge.. or shall I do it in a new PR?

@tomvanmele
Copy link
Member Author

since @beverlylytle will also still add the primitives for blender in a separate PR i would vote for merging!

@tomvanmele tomvanmele merged commit 8ea7ec3 into main Oct 12, 2021
@tomvanmele tomvanmele deleted the artist-factory branch October 12, 2021 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants