Jump to content
Ultimaker Community of 3D Printing Experts


  • Content Count

  • Joined

  • Last visited

Community Reputation

3 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hey, late reply but good news. What you want to do is exactly how Cura works behind the scenes. When adding a triangle (or quad, or line...), Cura uses setVertexColor() on each of its 3 vertices, but uses the same color so there's no gradient. What you can do is first create your mesh with your primitives, and afterwards go vertex by vertex changing the color. For example, I tested it on this cube I built for a project of mine. It's made up of 10x10x10 quads. Mind you, quads are actually just a pair of triangles: Then I used this code to randomize the
  2. In the FEM plugin I'm developing, I've got a disparity between color tones in the OpenGL-rendered object and in the color chart: For example, the max tension is represented as red (255, 0, 0, 1), both in rendering and inside QML. The 4 lower vertices of the cube have the max tension, so they should have the same red (but they're clearly pinkier). I'm rendering with the simplest shader, default.shader, so there's no special color or lightning effects (diffusion, specularity...) that I know of. I've just recently started learning about shaders. If we lo
  3. If you have access to Solidworks, the easiest way is to edit the original SLDPRT. You can create a revolved profile to fill the hole, for example. For editing the stl, you'd need a second stl with the shape of the conic hole you want to plug, and a program that can combine (boolean addition) both stls. MeshLab can combine stls, but can't create your 'plug'. Blender can do both, but is more complex. With Blender you can also manually edit the mesh, but I guess this is a bit advanced.
  4. [Hey ahoeben, I was just writing a solution I've found, which uses addLine(). Since I've got it almost written I'll just leave it here for anyone curious, but I'll try using a shader as you say] I've discovered that I can simply create a second mesh inside a single SceneNode, and then render each mesh separately. I discovered this by looking into Cura's BuildVolume class. More or less my code is this: 1) Create a _grid_mesh and build the wireframe with AddLine() 2) Override the SceneNode.render() method: def render(self, renderer): if (self.isVisib
  5. One additional related question if you don't mind: how would you approach drawing the edges (black lines delimiting each square) like in my first screenshot? 1) With addLine(): I've tried but for some reason the resulting mesh is not drawn correctly when combining addQuad & addLine. 2) Option 1 but putting the lines in a child sceneNode's mesh 3) Some shader or rendering option, if it exists 4) Implementing a custom shader, akin to how the Platform is a single quad but draws a 1x1cm mesh 5) Something else
  6. Thanks, ahoeben. It works now with this change: def buildMesh(self, geometryData): self.mb = MeshBuilder() self.resultsMeshBuilder(geometryData) self.mb.calculateNormals() #Added this line mesh = self.mb.build() self.setMeshData(mesh)
  7. Hello guys. Some time ago I made a little Python application to visualize the results of a FEM study, and now I'm integrating it into a Cura plugin. However, the resulting SceneNode's mesh looks completely gray/colorless: The steps followed to prepare the mesh are: 1) Calculate the coordinates and color of every square. The algorithm is pretty much the same as in the old application so I didn't change much. 2) Create a SceneNode object. Make it a child of the Root SceneNode. 3) Use addQuad() to actually build the mesh by drawing each little square. More
  8. nallath's observation saved my skin: h5py's latest version requires Python 3.6, so it can't run on Cura (Python 3.5.x). However, a previous version (2.10.0) is still compatible. I've prepared a clean Windows 10 install (on a virtual machine to prevent any mix-up with different Python versions), There, I've installed the same Python version as Cura (3.5.4, 64 bit), pip-installed h5py 2.10.0, and copied the folder with the compiled files: C:/Users/xxxx/AppData/Local/Programs/Python/Python35/Lib/site-packages/h5py (might be Roaming instead of Local for some installs)
  9. I noticed that the compiled files were made for Python 3.8. Since Cura comes with Pyton 3.5.0, I repeated the process but this time using h5py compiled in a Windows system with Python 3.5.0 installed. This time, Cura crashes with this error: [...] h5py = cdll.LoadLibrary(path) #This replaces the usual "import h5py". h5py is now a usable module File "ctypes\__init__.py", line 429, in LoadLibrary File "ctypes\__init__.py", line 351, in __init__ OSError: [WinError 193] %1 is not a valid Win32 application
  10. Some time ago I made a python application which I am now integrating into a Cura plugin. It uses the h5py library, which is usually installed through pip. I assumed that copying the source code and using an 'import h5py' would be enough, but nope: the library is written in cpython, and when installed with pip it actually compiles into a bunch of dll and pyd files: I've unsuccessfully tried many ways to import it from this forum (1, 2), from StackOverflow (1), etc. Most methods involved copying the files compiled for my system, and loading them with ct
  11. For anyone interested, I've been using Cura remotely for some time with VNC. I use UltraVNC server on a laptop with Cura. It works correctly as long as I keep the lid open (if the screen is off Cura and other applications freeze over VNC). On the other PC I use VNCViewer by RealVNC but anything should work.
  12. Works perfectly now. Thank you nallath. For anyone with the same problem, here's the actual code: Inside my view's __init__(): self._name = "MyViewName" And to call the view: controller = CuraApplication.getInstance().getController() controller.setActiveView('MyPluginName_MyViewName')
  13. Hello again. In my plugin's init, in both getMetaData() and register(), I've used the method of using a list of dictionaries rather than a single dictionary to add my 2 views. The plugin loads correctly, but during boot I get the console error "NameOfPlugin was already added to view list. Unable to add it again". Afterwards, if I use getAllViews() it confirms that only the first view was added. Is there a correct way to add 2 views with a single plugin? And if so, how do I refer to them, seeing as they're addressed by the id of the Plugin that added them rather than th
  14. Smart Slice. It defines 2 tools here. You can see some demos in their website. In any case, it looks like setting up 2 stages is not an option. For whoever ends up here in the future with the same question, here's the alternative approach I've implemented: I've added a QML switch to select between two modes. When toggled, I fetch all SceneNodes in the scene and show/hide the appropriate ones using setVisible() and setEnabled(). It seems to work for now, but there are still some issues (e.g. SceneNodes remain hidden when changing back to Prepare stage).
  15. I'm making a (very simple) Finite Elements Analysis plugin where the user can A) Assign loads to the body, and B) Visualize the results on a new coloured mesh. I guessed the best way to present these would be in two tabs AKA stages. In the plugin's __init__.py I have this: def getMetaData(): return { #Add 2 new tabs (AKA Stages). #When adding 1 stage, the "stage" key holds a dictionary. #To add 2 stages, the "stage" key holds a list of dictionaries. "stage": [ { "name": i18n_catalog.i18nc("@item:inmenu", "FEM_STAG
  • Create New...