cadquery icon indicating copy to clipboard operation
cadquery copied to clipboard

Visualizing multiple vertices (3d points)

Open jorritsma opened this issue 1 year ago • 2 comments

Very nice and interesting library. I am a newbie, and I like to learn this library.

As a challenge, I like to model (complex) polyhedrons. Therefore I want firstly visualize the vertices (3d points). I tried this script:

verticesXYZ = (
    (0,0,0), (1,0,0), (1,1,0),(0,1,0),
    (0,0,1), (1,0,1), (1,1,1),(0,1,1)
)

vertices = []

for v in verticesXYZ:
    vertices.append(cq.Vector(v))

show(vertices)

This code results in an NotImplementedError for the list of Vectors I put into the show function. I also tried to make objects of class cq.Vertix instead of cq.Vector. Showing Vertix objects throws the following error: tuple' object has no attribute 'IsNull'". I use Jupyter Cadquery with Visual Code as GUI. Furthermore I tried to put the vertices in a Workplane, Sketch or Assembly. Other objects like cubes etc, are showed correctly. Showing 1 point is also working.

Any suggestion, how to show multiple points?

Kind regards!

p.s. I am also interested in more conceptual background documentation/literature about the concepts of CADQuery and 3d modelling in common. Sharing links is appreciated!

jorritsma avatar Jul 22 '24 09:07 jorritsma

You can display vertices in CQ-editor. I do not know about other tools, you'll need to open issues on their trackers and not here.

from cadquery.occ_impl.shapes import *

verticesXYZ = (
    (0,0,0), (1,0,0), (1,1,0),(0,1,0),
    (0,0,1), (1,0,1), (1,1,1),(0,1,1)
)

vertices = []

for v in verticesXYZ:
    vertices.append(vertex(*v))

show_object(vertices)

afbeelding

adam-urbanczyk avatar Jul 23 '24 05:07 adam-urbanczyk

Thanks for reply! Visualizing in cq-editor works also for me. So the issue is a problem with Jupyter Cadquery for visualizing vertices.

jorritsma avatar Jul 24 '24 10:07 jorritsma