SilverScreen Solid Modeler

Good Advice

Good Advice

Previous topic Next topic  

Good Advice

Previous topic Next topic JavaScript is required for the print function  

SilverScreenAPI

 

 
Good Advice

 

 

 


 

 


 

r_point

Hierarchy

The hierarchical drawing structure is an important organizational tool. There is a strong relationship between the organization of the drawing and the organization of the information about the drawing. A block can be used to store information about the group of entities contained in the block. Information about an elementary entity can be stored with that entity.

 

r_point

Tags

Tags are normally a better means for storing information than schemas. They are faster to access and do not depend on an external library.

 

r_point

Entity Names

The names given to entities in a drawing are important. Suppose that a drawing consists of rooms where each room is a block. Further suppose that each room contains walls and doors, where each door is a block containing hinges, a doorknob and a panel. If all of the doorknobs are given a common prefix, then a wildcard can be used to isolate doorknobs (i.e., to make doorknobs visible and all other entities invisible). If common prefixes are also used for the other entities, then it is a simple matter to make walls and doors visible and hinges and doorknobs invisible.

 

r_point

Control of Screen Refresh

Consider the following sequence of commands:

 

Command Script

 

 sweep linear polygon \obj1.3 points 0,0,0 0,0,-10 name box

 view select isometric front right top

 zoom object \box

 hide object \box hidden-line

 

 

When these commands are executed, the user would first see a sweep operation, followed by a change of view, followed by a zoom to the object, followed by hidden-line removal; probably a lot of unnecessary screen activity.
 
The control variable CV_REFRESH can be used with cv_set to control screen refreshes. When refresh is off, commands will execute without disturbing the contents of the screen. The following avoids unnecessary screen refresh:

 

C / C++ Code

 

cv_set (CV_REFRESH,0)

ss_command(“sweep linear polygon \\obj1.3 points 0,0,0 0,0,-10 name box”);

ss_command (“view select isometric front right top”);

ss_command (“zoom object \\box”);

cv_set (CV_REFRESH,1);

ss_command (“hide object \\box hidden-line”);

 

 

 

r_point

Wildcards

It often occurs that an object of a certain type, say a doorknob, is to be picked by the user. The function to accomplish this is pick_entity . Unfortunately, pick_entity is not particularly clever. This function will pick the nearest visible object whether it be a doorknob or a light bulb.
 
A nice solution is the following:

 

C / C++ Code

 

 cv_set ( CV_REFRESH, 0 );_

 ss_command (“isolate object !knob*”);

 if ( pick_entity ( "Pick doorknob", BITS_OBJECT, path ) )

    ...

 else

    ...

 ss_command (“isolate reset”);

 cv_set (CV_REFRESH, 1 );

 

 

The trick is to isolate those objects that are candidates for selection without disturbing the screen. Once the pick has been made, isolation can be reset, again without disturbing the screen.

 

record_visibility is also a useful function in this context.

 

r_point

Annotation Environment

Many applications require a specific annotation environment. This can be handled by loading a private annotation environment.