Overview
/
KCL Standard Library
/
Functions
/
view::named

view::namedFunction in std::view

WARNING: This function is experimental and may change or be removed.

Create a named view: a camera paired with the objects the view shows or hides.

A view is data, not an action. Creating one moves no camera and changes nothing about what is visible; a consumer such as the modeling app or a STEP export activates it later, which is why the same file yields the same views on every machine.

The name is display text, so it may contain spaces and punctuation. It is required, because a view is identified by the name you give it and not by the variable you bind it to, so renaming a variable never renames a view. Names are unique within one file and compared exactly, which makes Front and front two different views. Four names are rejected:

  • the empty string, which identifies nothing;
  • a name of nothing but whitespace, which displays as nothing;
  • a name that starts or ends with whitespace, which a reader cannot see but the exact comparison above counts;
  • KCL Default, which is reserved for the view of the scene generated on successful execution of the program.

baseline and except together decide what the view shows. You start from a clean state: baseline sets the visibility every object takes, and except lists the objects that depart from it. Every view writes its baseline out, so what a view shows can be read from the call alone:

  • baseline = Visibility::Show alone: everything is visible;
  • baseline = Visibility::Show with except = [a, b]: everything is visible except a and b;
  • baseline = Visibility::Hide with except = [a, b]: only a and b are visible;
  • baseline = Visibility::Hide alone: nothing is visible.

Duplicates in except are dropped, so listing an object twice does the same as listing it once.

Arguments

NameTypeDescriptionRequired
namestringThe name of the view, as a reader should see it. Required, unique within the file, and compared exactly.Yes
cameraCameraViewThe camera the view activates. Call view::oriented() or view::directed() to build one.Yes
baselineVisibilityThe default visibility of every object the program creates: visible under Visibility::Show, hidden under Visibility::Hide. Use except below to override that default for individual objects.Yes
except[Solid or Sketch or GdtAnnotation; 1+]The objects the baseline does not apply to: the hidden ones under a Show baseline, and the only visible ones under Hide.No

Returns

NamedView - A named view: a camera paired with the set of objects it shows or hides.

Examples