RhinoDoc.Import() is interrupted with 'import scaling' confirmation

I’m working on a project where I need to import blocks from other rhino files to a current document.
I’m using a construction like this:

using (var libraryDoc = Rhino.RhinoDoc.CreateHeadless(null))
                {
                    foreach (var filePath in filePaths)
                    {
                        if (!System.IO.File.Exists(filePath)) continue;
                        if (!libraryDoc.Import(filePath)) continue;
                        ...
                    }
                 }

The problem is that sometimes the process interrupts asking for a confirmation from a user. And a user has to keep pressing Enter until all the blocks are imported.

image

Units and tolerances are the same in the current document and in the source doc.

Is there a way to suppress these messages?

You’ll want to use ReadFile instead of Import, with the FileReadOptions parameter to it set up such that you do import with the wanted scaling behavior.

Thanks Nathan! I’ll give it a try

Hello,
I am using ReadFile and also defining FileReadOptions:

image

image

However, the import is still interrupted saying “import scaling - DimensionNumbers”

image

I am using the ReadFile command to import a .3dm rhino file.

I am also experiancing this Import Scaling Prompt - rather a pain when i have several hundred files to import.

@nathanletwory could you confirm the correct set of options to set to avoid the scaling prompt?

I tried many variations of this

FileReadOptions readoptions = new FileReadOptions() {
				ImportMode       = true,
				BatchMode        = true,
				UseScaleGeometry = true,
				ScaleGeometry    = false, 
			};