OpenDoc6 Method (ISldWorks)

您所在的位置:网站首页 open6 OpenDoc6 Method (ISldWorks)

OpenDoc6 Method (ISldWorks)

2023-10-20 06:48| 来源: 网络整理| 查看: 265

As of 2012 SP5, loading future file versions is supported, and ISldWorks::OpenDoc6 no longer throws a swFileLoadError_e.swFutureVersion error. Use IModelDocExtension::IsFutureVersion to determine whether a component is for a future version of SOLIDWORKS.

This method also allows control over whether to:

Suppress displaying dialog boxes

Open the document read-only

Open the document in Large Design Review mode

Convert a drawing to a detached drawing

When opening a parent document (assembly, drawing, and so on):

SOLIDWORKS also opens any additional documents that are referenced in the parent document (parts, subassemblies, and so on).

SOLIDWORKS follows certain rules in trying to locate its referenced documents. If explicit Search Folders have not been set using Tools, Options, System Options, ExternalReferences, then the first place SOLIDWORKS looks for the referenced documents is in the current working directory. If SOLIDWORKS finds the referenced file in the current working directory, then it is loaded from that directory.

Calling ISldWorks::OpenDoc6 does not change the current working directory to that of the opened file, whereas, interactively using the File Open dialog box does. This may affect documents with references.

Because the user may have interactively opened files from some random directory, you cannot be certain that the current working directory is pointing to the desired location. This may affect the referenced documents that ultimately get loaded when using ISldWorks::OpenDoc6 versus performing File Open interactively. You may want to set the current working directory before calling ISldWorks::OpenDoc6. This can be done using the ISldWorks::SetCurrentWorkingDirectory method. To mimic the behavior of the File Open dialog, you set the current working directory to that of the file being opened.

When opening files that contain references, you may also want to consider the current Search Folder settings because they may affect the references that ultimately get loaded. This can be done using ISldWorks::GetSearchFolders and ISldWorks::SetSearchFolders. If Search Folders are currently in use, SOLIDWORKS looks for references in the Search Folders before trying to locate references in the current working directory.

If this method successfully opens an assembly, it still returns swFileLoadError_e.swFileNotFoundError in Errors if a referenced component file cannot be located.

ISldWorks::OpenDoc6 does not activate and display the document if the file is already open in memory in an assembly or drawing. However, ISldWorks::OpenDoc6 should return a valid IModelDoc2 pointer that is usable with functions that do not require a document to be displayed. If you want, ISldWorks::ActivateDoc2 or ISldWorks::IActivateDoc3 will activate and display the document. Because calling ISldWorks::OpenDoc6 does not activate nor display the file, calling the ISldWorks::ActiveDoc or ISldWorks::IActiveDoc2 property will not return a pointer to this document.

This method fires the the SOLIDWORKS event FileOpenNotify2 event. Also, the SOLIDWORKS event ActiveDocChangeNotify and ActiveModelDocChangeNotify events are sent if the file being loaded is not already open as the active document.

 

TIPS

To...

Then...

Open an assembly in Large Design Review mode

Set the Options argument to swOpenDocOptions_ViewOnly. This option displays large assemblies without actually loading them. This is useful for conducting a quick walk-through of a large assembly. Call IAssemblyDoc::SelectiveOpen to open selected components after an assembly has been opened in Large Design Review mode.

Avoid warnings when opening the document

Set the Options argument to swOpenDocOptions_Silent. The software uses the last-displayed configuration if it discovers missing configurations or component references.

Open a library feature part

Set the Type argument to swDocPART.

Open foreign files (IGES, STEP, and so on)

Use ISldWorks::LoadFile4.

Avoid a warning when opening shaded models in views

Set the Options argument to swOpenDocOptions_LoadModel. This option loads the model so that the view comes in shaded automatically.

Avoid large increases in memory usage caused when adding parts to assemblies

 

Opening a model causes SceneGraph to display the model. SceneGraph uses maps with defaults sizes of 2MB - 3MB for even the simplest model. And, assemblies and parts do not share the same SceneGraph buffer. To avoid large increases in your memory usage:

Set the document to invisible.

Open the parts.

Set the document to visible.

Add the part to the assembly.

See ISldWorks::DocumentVisible for details.

Open a document with a specified display state Use ISldWorks::OpenDoc7.

A warning is displayed if you open a Detached drawing without loading the model, and the model was saved since the drawing was last saved.

This method honors the ISldWorks::GetUserPreferenceIntegerValue and ISldWorks::SetUserPreferenceIntegerValue swLargeAsmModeAutoActivate, swPromptAlwaysNever_e setting.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3