I need to process a dgn file using OpenDesignFileForProgram and need to use SendCommand or SendKeyIn to the file. (I am forced to use keyins as there is no VBA equivalent for keyin: ITEM DUMP)
Is this possible?
Hi Lisa,
I am pretty sure it's not possible to use key-ins with a design file opened "for program" mode.
When you access the file using OpenDesignFileForProgram, it's more like using binary stream with some extra functionality, which converts binary access to "per design file elements" access. But such access is direct and the rest of MicroStation does not know about it and many modules (raster manager, full references handling etc.) are not initialized and available. Equally some parts of VBA API (cad input queue, property handlers...) are not functional.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Unknown said:I need to process a dgn file using OpenDesignFileForProgram
Why can't you use OpenDesignFile()? Unless you have very good reasons for using OpenDesignFileForProgram() then OpenDesignFile() is always the better choice.
OpenDesignFile()
OpenDesignFileForProgram()
Regards, Jon Summers LA Solutions
Hello Jon,
is it possible to create and analyse FENCE with designfile opened using OpenDesignFileForProgram ?
My second question : I did manage to delete elements from designfile opened using the same methode but how do i add elements into it, i have read the Bentley Documentations saying that AddElement will not add an element to a file opened with OpenDesignFileForProgram. Use CopyElement instead. Can you give me some examples about adding element to the designfile ?
Thanks in advance for your Help,
Sopheak
OpenDesignFileForProgram
Sopheak PHAL said:is it possible to create and analyse FENCE with designfile opened using OpenDesignFileForProgram ?
No. A fence is an artefact created for the active DGN model. When you OpenDesignFileForProgram you are not working with an active model.
Sopheak PHAL said:AddElement will not add an element to a file opened with OpenDesignFileForProgram.
AddElement requires a model reference obtained from the active model.
AddElement
Sopheak PHAL said: Use CopyElement instead
Sound advice!
Sopheak PHAL said:Can you give me some examples about adding element to the designfile ?
You add an element to a DGN model, not to the design file. VBA help is clear: AddElement will not add an element to a file opened with OpenDesignFileForProgram. Use CopyElement instead. When a program creates an element, the Create...Element method assigns symbology from the master file. CopyElement performs any necessary transformations on the symbology, copying line style and level information into the file if necessary.
Hi Sopheak,
please do not hijack the discussion!
The original question is more than a year old and is about different topic (key-in usage with work DGN), so to reopen it with different topic (even more than one in your case) is a violation of best practices and good behaviour.
So when there will be more question about Jon's comment, please create new posts, one for every question you have.
Thanks Jan for your feedback, i will pay more attention next time before posting a topic.
Thanks Jon for your quick reply,
The purpose of trying to use OpenDesignFileForProgram is to make the process much faster.
Sopheak PHAL said:to make the process much faster.
what is the process you mentioned?
A difference between active model and work design (a file and model opened using OpenDesignFileForProgram) is not in processing speed. In general to open a file and model for editing is slower than to open work design, but it's because not all MicroStation features are initialized and available for the work design.
I recommend to post a new question and to explain what process you want to implement. Often people focus too much to technical details when a main issue is somewhere else.
Yes Jan, as you mentioned, it would be better to create a new topic. I will recap all the problems and needs and will submit as a new subject..
Thanks for your helps and Happy New Year to you all. See you in the new Topic.
Best Regards;
Lisa Chan said:I need to process a dgn file using OpenDesignFileForProgram
I've attempted to clarify when to use OpenDesignFileForProgram in this blog.