pub struct PmiState {
pub views: Vec<PmiView>,
pub id_counter: u64,
}Expand description
The document’s pmi block. Loading it folds every view’s legacy
display.hidden list into that view’s baseline hide step (see
PmiDisplay), so every reader — the run, the parts library, STEP
export, plugins, the 3D PDF — sees one representation.
Fields§
§views: Vec<PmiView>§id_counter: u64Mints every view AND annotation id (VIEW{n}, DIM{n}, …); monotonic,
never reused, re-seeded from the largest numeric suffix on load.
Implementations§
Source§impl PmiState
impl PmiState
Sourcepub fn set_view_baseline(&mut self, view_id: &str, names: &[String]) -> bool
pub fn set_view_baseline(&mut self, view_id: &str, names: &[String]) -> bool
Replace view view_id’s baseline hide step with one naming names
(none when empty), keeping the old step’s id and place. False when
nothing changed or there is no such view.
Sourcepub fn hide_in_view(
&mut self,
view_id: &str,
names: &[String],
) -> Option<String>
pub fn hide_in_view( &mut self, view_id: &str, names: &[String], ) -> Option<String>
Hide names in view view_id as a new hide step (the viewport’s
hide while the view is active): only the names the view does not hide
yet. The new step’s id, or None when nothing new is hidden.
Sourcepub fn show_in_view(
&mut self,
view_id: &str,
names: &[String],
solids: &[String],
) -> bool
pub fn show_in_view( &mut self, view_id: &str, names: &[String], solids: &[String], ) -> bool
Show names in view view_id (the viewport’s show while the view is
active): every enabled hide step drops them; a step target naming a
whole component one of them belongs to becomes that component’s other
solids (from solids, the scene’s names); a step left with no target
goes. True when a step changed.
Make view view_id hide exactly names among solids (MCP
pmi_set_view_display’s hidden): what it hides beyond them is shown
(Self::show_in_view), and what it does not hide yet joins its
baseline step. True when a step changed.
Sourcepub fn next_id(&mut self, prefix: &str) -> String
pub fn next_id(&mut self, prefix: &str) -> String
Mint the next id with prefix (VIEW → VIEW3). The counter is
re-seeded first from the largest numeric suffix already in the block,
so an edited or merged document never hands out a colliding id.
pub fn find_view(&self, id: &str) -> Option<&PmiView>
pub fn find_view_mut(&mut self, id: &str) -> Option<&mut PmiView>
Sourcepub fn find_annotation(&self, id: &str) -> Option<(&PmiView, &PmiAnnotation)>
pub fn find_annotation(&self, id: &str) -> Option<(&PmiView, &PmiAnnotation)>
The annotation with id and its owning view.
Sourcepub fn locate_annotation(&self, id: &str) -> Option<(usize, usize)>
pub fn locate_annotation(&self, id: &str) -> Option<(usize, usize)>
The owning view id and index of annotation id.
pub fn find_annotation_mut(&mut self, id: &str) -> Option<&mut PmiAnnotation>
Sourcepub fn datum_letters(&self) -> Vec<(String, String)>
pub fn datum_letters(&self) -> Vec<(String, String)>
Every datum letter defined in the part (any view), in definition order, with the defining annotation’s id — the part-level datum registry a feature control frame validates its references against.
Sourcepub fn next_datum_letter(&self) -> Option<String>
pub fn next_datum_letter(&self) -> Option<String>
The next unused datum letter: A–Z skipping I, O and Q (ASME Y14.5),
then AA, AB, … (None only past ZZ).