Skip to content

Using 2 times pushPoints() offsets positions #202

@bragostin

Description

@bragostin

Running the code below produces the results shown in the attached image: there is an offset of 0.6 mm between the holes through the shell and the holes through the cylinders while they should be coincident. In some other cases it goes up to 1.6 mm. Could this be coming from some accuracy setting somewhere?

import numpy as np
import cadquery as cq

y_sh = np.array([14.5,15,15,14.5,29.5,62.3,70,70,119,119,125,125,129.8,131.8,132,132]) - 140./2.
z_sh = np.array([22.5,39.5,89.5,107.5,15.9,122.5,22.5,107.5,22.5,107.5,39.5,89.5,140.,15.9,108,126]) - 145./2.
dsh = np.array([6.5,6.5,6.5,6.5,5.5,5.5,6.5,6.5,6.5,6.5,6.5,6.5,5.5,5.5,5.5,5.5])

cq_object = cq.Workplane('XY').box(5, 140, 145).cut(cq.Workplane("XY" ).box(4, 138, 143))

y_pl = np.linspace(-64, 64, 13)
z_pl = np.linspace(-66.5, 66.5, 13)
y_pl, z_pl = np.meshgrid(y_pl, z_pl)
yz_pl = [(y,z) for y,z in zip(y_pl.flatten(), z_pl.flatten())]
pl = cq.Workplane('YZ').workplane(offset=-2).polygon(4, 10).extrude(4)
def s_pillar(pos):
    return pl.translate(pos).val()
pillars = cq.Workplane('YZ').pushPoints(yz_pl).each(s_pillar)

for dh in np.unique(dsh):
    ysh = y_sh[dsh==dh]
    zsh = z_sh[dsh==dh]
    yzsh = [(y,z) for y,z in zip(ysh.flatten(), zsh.flatten())]
    cq_object = cq_object.faces('<X').workplane().pushPoints(yzsh).polygon(12, dh).cutBlind(-5)
    pillars = pillars.faces('<X').workplane().pushPoints(yzsh).hole(dh)
    
show_object(cq_object)
show_object(pillars)

holes_pos

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions