geom_split_object

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

geom_split_object

randress
I can find no reference to geom_split_object beyond its mention in the documentation (v 1.12):
file  	geom_split_object.m
 	GEOM_SPLIT_OBJECT Split composite geometry object.

and the content of the MATLAB script/function file ("geom_split_object.m") itself:

function [ varargout ] = geom_split_object( varargin )
%GEOM_SPLIT_OBJECT Split composite geometry object.

% Copyright 2013-2020 Precise Simulation, Ltd.

if( ~nargin && ~nargout ), help geom_split_object, return, end
varargout = cell( 1, nargout );
[varargout{:}] = featool( 'feval', 'geom_split_object', varargin{:} );
if( ~nargout ), clear varargout; end

Does anyone know whether it is meant to provide a useful function to the user? If "yes", then is there other documentation or an example of its use?

Kind regards,
-Randal

Reply | Threaded
Open this post in threaded view
|

Re: geom_split_object

Precise Simulation
Administrator
randress wrote
I can find no reference to geom_split_object beyond its mention in the documentation:
This function is used by the GUI in geometry mode when the "Undo/split/restore combined or transformed geometry objects" button is clicked. It is not particularly useful for command line/scripting as you can just manually extract the children from any geometry object. But for reference the implementation of the function looks like:

function [ geom ] = geom_split_object( geom, tag )
%@file geom_split_object.m @brief GEOM_SPLIT_OBJECT Split composite geometry object.

% J.S. Hysing 150227.
% Copyright 2013-2015 Precise Simulation Ltd.


if( ischar(tag) )
  ind = find(strcmp( tag, geom_get_tags(geom,0) ));
elseif( isnumeric(tag) )
  ind = tag;
end

n_obj = numel(geom.objects);
if ( ~isempty(ind) && ind>=1 && ind<=n_obj )

  gobj = geom.objects{ind};
  if ( isfield(gobj,'children') )
    geom.objects = [ geom.objects(1:ind-1) gobj.children geom.objects(ind+1:end) ];
    geom = geom_update_tags( geom );
  else
    warning('geom_split_object: no children found.')
  end

else
  warning('geom_split_object: composite object not found.')
end
Reply | Threaded
Open this post in threaded view
|

Re: geom_split_object

randress
Precise Simulation wrote
This function is used by the GUI in geometry mode when the "Undo/split/restore combined or transformed geometry objects" button is clicked. It is not particularly useful for command line/scripting as you can just manually extract the children from any geometry object. But for reference the implementation of the function looks like:
I see. Thanks for the explanation and the implementation.  I found helpful and instructive seeing the MATLAB-ese methods you used, e.g., dealing with "amorphous data types".. ischar(), isnumeric(), and exploring "variant" structs ...  isfield(gobj,'children') ...

Kind regards,
Randal