MCPcopy
hub / github.com/CadQuery/cadquery / show

Method show

cadquery/fig.py:259–334  ·  view source on GitHub ↗

Show objects.

(
        self,
        *showables: Showable | vtkProp3D | list[vtkProp3D],
        name: Optional[str] = None,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

257 self._run(_())
258
259 def show(
260 self,
261 *showables: Showable | vtkProp3D | list[vtkProp3D],
262 name: Optional[str] = None,
263 **kwargs,
264 ):
265 """
266 Show objects.
267 """
268
269 # generate an uuid
270 uuid = str(uuid1())
271
272 # split objects
273 shapes, vecs, locs, props = _split_showables(showables)
274
275 pts = style(vecs, **kwargs)
276 axs = style(locs, **kwargs)
277
278 # to be added to state
279 new_actors = []
280
281 for s in shapes:
282 # do not show markers by default
283 if "markersize" not in kwargs:
284 kwargs["markersize"] = 0
285
286 actors = style(s, **kwargs)
287 self.shapes[uuid] = s
288
289 for actor in actors:
290 self.ren.AddActor(actor)
291
292 new_actors.extend(actors)
293
294 for prop in chain(props, axs):
295 self.ren.AddActor(prop)
296
297 new_actors.append(prop)
298
299 if vecs:
300 self.ren.AddActor(*pts)
301
302 new_actors.append(*pts)
303
304 # if nothing to show return early
305 if not new_actors:
306 return self
307
308 # store to enable pop
309 self.last = (shapes, axs, pts if vecs else None, props)
310
311 async def _show():
312 self.view.update()
313
314 self._run(_show())
315
316 # zoom to fit on 1st object added

Callers 2

showFunction · 0.95
test_figFunction · 0.80

Calls 8

_runMethod · 0.95
fitMethod · 0.95
_update_stateMethod · 0.95
_split_showablesFunction · 0.85
styleFunction · 0.85
idFunction · 0.85
extendMethod · 0.80
appendMethod · 0.80

Tested by 1

test_figFunction · 0.64