Functions/methods for spelunking over dependency back pointers tha may help.
mdlDependency_getNumOfDependents
mdlDependency_getDependentElementRefs
elementRef_getFirstDependent
elementDependent_getNext
elementDependent_getElemRef
-B
Functions/methods for spelunking over dependency back pointers tha may help.
mdlDependency_getNumOfDependents
mdlDependency_getDependentElementRefs
elementRef_getFirstDependent
elementDependent_getNext
elementDependent_getElemRef
-B
[quote user="Matt Spencer"]It looks like the IPrimitiveCommandEvents_DataPoint Method does what I want, but I am having trouble calling it from a dialog box button[/quote]
A locator class does what you expect — it locates things. If the points you want are always part of an element (e.g. a line end point) then ILocateCommandEvents is what you need.
If you want to gather a point placed anywhere, then you don't want to be locating something, and a class that Implements IPrimitiveCommandEvents should do you. You can start that command class from a UserForm command button much the same as your locator class...
Sub MyButton_click () Dim oPointPicker As New clsPointPicker ' this is your class that Implements IPrimitiveCommandEvents CommandState.StartPrimitive oPointPicker End Sub
[quote user="Matt Spencer"]CommandState.SetLocate oLocator[/quote]
That should be...
CommandState.StartLocate oLocator
[quote user="Daniel MacNeil"]Is there another way to just unload the app?[/quote]
My apps. always have an exit command, which does this...
mdlDialog_cmdNumberQueue (FALSE, CMD_MDL_UNLOAD, mdlSystem_getCurrTaskID (), TRUE);
When you queue an unload command, your app. will have an orderly shutdown rather than an abrupt exit. For example, your OnUnload event handler will be called, giving you an opportunity to save settings or data before the app. finally quits.
Hi,
I have an old MDL program that I am upgrading to C++. It is a small utility program that loads, runs and is then unloaded using mdlSystem_exit (0,1). In C++ that function call causes Microstation to crash.
Checking the Help I see that that function is obsolete and I should use the standard exit() function instead. Unfortunately when I use exit(EXIT_SUCCESS) Microstation exits completely instead of just unloading the app.
Is there another way to just unload the app?
TIA
Dan
My query tool inherits from DgnElementSetTool. It works fine for elements in the active model, but what should I do to enable it to locate elements in a reference?
Currently the tool shows a pop-up Element in reference that is not currently active or Element is in a ReadOnly ref.
I am trying to create a script to link individual jpg files (hundreds) to respective text nodes (geographically unique), using relative paths. For what it is worth, I am generating the script using XSL against XML file(s) that contain the position and content for the text nodes, and I want to link a photo (filename.jpg also in XML file) to the node. I have a working script, that will create a text node in a unique location, and create a link between the jpg file and text node, so long as I use the full path to the file.
The method I am using that works is:
element create link file drive:/folder/project/photos/filename.jpg
I have tried that does not work is:
element create link file ../photos/filename.jpg
where the dgn file is located at drive:/folder/project/dgn/filename.dgn
Does anyone have any thoughts on how to correctly use relative paths in this instance?
[quote user="Todd Moser"]Is it possible to use relative path rather than full path?[/quote]
I can see why that would be useful, but it's not really a question for the Programming Forum, since it doesn't involve VBA or C++. Try posting to the MicroStation Forum.
How do you set active Z for NamedView? There is a function GetActiveZ in ViewInfo, but no SetActiveZ. And mdlViewInfo_setActiveZ takes ViewInfoP as argument and I don't see how I cat get that from NamedView or ViewInfoR. My V8i code has calls like:
mdlViewInfo_create(&viewInfoP); mdlViewInfo_createDefaultData(viewInfoP, view_number, ACTIVEMODEL, NULL, NULL, view_number, TRUE); mdlViewInfo_setName(viewInfoP, viewName); mdlViewInfo_setDescription(viewInfoP, description); mdlViewInfo_setOrigin(viewInfoP, &origin); mdlViewInfo_setDelta(viewInfoP, &delta); mdlViewInfo_setRotation(viewInfoP, &view_matrix); mdlViewInfo_setActiveZ(viewInfoP, origin.z);
I answered my own question. The solution is to add mdlLocate_allowLocked() in the _OnPostInstall event...
void QueryTool::_OnPostInstall () { //Enable picking of elements _BeginPickElements (); mdlAutoLocate_setComplexComponentMode (ComponentMode::Innermost); //NOTE: Must be called after BeginPickElements! __super::_OnPostInstall (); //Permit location of elements in references mdlLocate_allowLocked (); }
Note that mdlLocate_allowLocked() must be called after__super::_OnPostInstall ().
I was initially put off using mdlLocate_allowLocked() because of this note in MicroStationAPI help...
Obsolete enum; here only to help convert code.
Is that note irrelevant?
Hello Jon,
Apologize a long time not in this English forum because there is always a lot Chinese posts on ChinaFirst Programming forum.
A formal and simpler approach to do this is to override _IsModifiedOriginal member function and return false.
virtual bool _IsModifyOriginal () override {return false;}
Another recommendation:
mdlAutoLocate_setComplexComponentMode can normally be called in _SetupAndPromptForNextAction where _BeginPickElements has been called.
Is it possible to examine an ElementTemplate to inspect if it has an "item" definition? I don't see anything in ElementParameterType that looks like an item.
Thanks,
Bruce
[quote user="Yongan.Fu"]Apologize a long time not in this English forum[/quote]
Good to hear from you again!
[quote user="Yongan.Fu"]virtual bool _IsModifyOriginal () override {return false;}[/quote]
I tried that but it doesn't work. Is there some other virtual method I should change?
[quote user="Barry Lothian"]How do you remove them from the cell before calling rewrite?[/quote]
See the Cell.CopyCurrentElement and Cell.ReplaceCurrentElement methods. There's an example in VBA help.
The following position statement supersedes all previous statements or positions on this topic:
Since the introduction of PowerDraft in the 1990s, MicroStation-based products have included programming capability using Microsoft Visual Basic for Applications (VBA). PowerDraft has never routinely included (for third-party developers or end-users) the ability to develop and deploy custom MDL applications. Development of custom MDL applications has been, and continues to be, the domain of MicroStation and Bentley vertical products based on MicroStation.
Lately, you may have read posts in one of the many the Bentley Communities that referred to “passcodes” for PowerDraft which may be misconstrued to suggest that there is a readily available method to “turn on” the execution of MDL applications within power products. “Passcodes” are not intended to “flip a switch” in MicroStation-based products to enable MDL execution. They are a technical aspect of product development for internal use by Bentley developers to continually improve on Bentley products which are on rare occasions used by Bentley partners for specific offerings.
To restate Bentley’s position: such “passcodes” are an internal, technical component of the MicroStation platform and are not a benefit of any SELECT, ELS or BDN entitlement. They are to be used only in rare cases to address unique situations. Only BDN commercial developers may request an exemption to use “passcodes”, however these are seldom granted and may be declined without comment.
PowerDraft users have vast custom programming power using VBA, which continues to be developed and fully supported. VBA is the recommended approach for automating workflows. For more information on VBA functionality within MicroStation, PowerDraft and other Bentley products, please see the online reference or visit the MicroStation community hosted on Bentley Communities.
--Bentley Systems, Incorporated
Trying to use EditElementHandle::AppendElementLinkage() and the doc's say to call LinkageUtil::SetWords() first on the new linkage header. I don't see that method declared anywhere. Anyway, wouldn't setting wdExponent and wdMantissa achieve the same thing? Anyway, I tried that (setting the wtf), but all my calls to AppendElementLinkage() don't return SUCCESS. I am also having difficulty (i.e. cannot successfully create) using mdlLinkage_appendUsingDescr(). On this function, I get no "failure", but I get no linkage either when looking at Element Properties...
Bruce