Eyeshot provides flexible methods to open, insert, or append geometry from external files into an existing Workspace or Document.
Geometry import is handled through the ReadFileAsync class, which parses the source file and exposes its content.
Entity regeneration can be performed synchronously or asynchronously, depending on the import method used.
After a file has been successfully read, the ReadFileAsync instance contains all master collections (Layers, TextStyles, Blocks, Materials, etc.) and a RootBlock containing the top-level entities of the file.
Even when the file does not define an explicit root block, one is always created to host the file entities.
For convenience, the ReadFileAsync.Entities property is a direct wrapper for:
ReadFileAsync.Blocks[ReadFileAsync.Blocks.RootBlockName].Entities
This article focuses on geometry integration into a document.
For details about file parsing, synchronous and asynchronous reading, and access to imported data before insertion, refer to the Geometry Import/Export article.
OpenTo / OpenToAsync
Replaces the entire content of the target Design with the file content.
Synchronous version
readFile.OpenTo(design);
Asynchronous version
await readFile.OpenToAsync(design);
Behavior:
- Clears all existing entities and master collections.
- Resets the default items of the master collections to their initial values.
- Overwrites defaults with those defined in the file.
- Regenerates entities.
InsertTo / InsertToAsync
Inserts the file content into the target workspace as a single BlockReference.
Synchronous version
readFile.InsertTo(design1,
conflictPolicy: conflictPolicy.Rename,
insPoint: new Point3D(0, 0, 0));Asynchronous version
await readFile.InsertToAsync(design1,
conflictPolicy: conflictPolicy.Rename,
insPoint: new Point3D(0, 0, 0));Behavior:
- Inserts a reference to the file’s root block at the specified insertion point.
- Merges the file’s master collections into the workspace according to the chosen
conflictPolicy. - Optionally scales the block reference according to document units.
- Regenerates entities.
AppendTo / AppendToAsync
Appends entities from the file directly into the target design, without creating a block reference.
Synchronous version
readFile.AppendTo(design,
conflictPolicy: conflictPolicy.Rename);Asynchronous version
await readFile.AppendToAsync(design,
conflictPolicy: conflictPolicy.Rename);Behavior:
- Adds the entities from the file’s
RootBlockdirectly to the design. - Merges the file’s master collections into the workspace according to the chosen
conflictPolicy. - Optionally scales appended entities according to document units.
- Regenerates entities.
Synchronous vs Asynchronous Regeneration
The difference between synchronous and asynchronous import methods is related to entity regeneration, not file loading.
-
OpenTo,InsertTo, andAppendToperform entity regeneration synchronously.
The method call completes only after regeneration has finished. -
OpenToAsync,InsertToAsync, andAppendToAsyncperform entity regeneration asynchronously, allowing the UI thread to remain responsive while complex or large geometry is being regenerated.
Use the asynchronous variants when regenerating large or complex models in interactive applications to keep the UI responsive.
Regeneration options (advanced)
You can optionally provide a RegenOptions instance to customize the regeneration process.
var regenOptions = new RegenOptions
{
PreProcessSilhouettes = true,
ProgressBarText = "Regenerating imported geometry..."
};
await readFile.AppendToAsync(design,
regenOptions,
conflictPolicy: conflictPolicy.Rename);Available options:
-
PreProcessSilhouettes
Enables silhouette curve preprocessing during regeneration. -
ProgressBarText
Customizes the text displayed in the asynchronous regeneration progress bar.
RegenOptions does not control whether regeneration is synchronous or asynchronous.
That behavior is determined solely by the import method used.
Drawing-specific notes
When working with a Drawing workspace, the behavior of OpenTo / OpenToAsync and AppendTo / AppendToAsync differs slightly from Design.
Since entities are stored inside sheets, they are not automatically regenerated and displayed after opening or appending a file.
The sheet must be rebuilt using the ViewBuilder.
Refer to the Drawing workspace article for details on the rebuild process.
Conflict Resolution
All methods that merge master collections support the conflictPolicy parameter:
| Policy | Description |
|---|---|
| Rename | Renames the incoming item when a name conflict occurs. |
| KeepExisting | Keeps the existing item in the document and ignores the incoming item when a name conflict occurs. |
| Overwrite | Overwrites the existing item in the document with the incoming item when a name conflict occurs. |
Remove Jittering
All import methods support a remove jittering flag.
When enabled, a correction is applied to reduce visual jittering caused by very large coordinates.
See the related article for more details.
Comments
Please sign in to leave a comment.