Here's the DgnLink class hierarchy found in the MicroStationAPI help doc...
When one uses the Add Link tool in MicroStation, three choices are offered...
URL and From File are covered by the types listed above (DgnURLLink and DgnFileLink). But I can't see which class should be used for Key-in. Any suggestions?
DgnURLLink
DgnFileLink
Hi Jon,
Jon Summers said:Any suggestions?
You have to read documentation right and completely :-)
Check DgnURLLink class description: It encapsulates more URL options (because URL does not mean http only):
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Answer Verified By: Jon Summers
Jan Šlegr said:You have to read documentation right and completely
Well, yes...
The options for a URL DgnLink are specified by a schema...
enum Schema { SCHEMA_unrecognized = -1, SCHEMA_http, SCHEMA_https, SCHEMA_ftp, SCHEMA_mailto, SCHEMA_MSTN_keyin, SCHEMA_file };
There is a method to read the schema of a DgnURLLink, but no method or constructor to set the schema. There are undocumented handlers for DgnLinks, but no clue about how they should be used.
Regards, Jon Summers LA Solutions
Jon Summers said:There are undocumented handlers for DgnLinks, but no clue about how they should be used.
Links API is, in my opinion, weird sometimes, maybe because implemented long time ago (it's not CE feature, but V8i) and maybe implemented not using EC data (as nearly everything new in CE).
On the other hand, some aspects and API workflows, how to access and created links were discussed several times already, so it is possible to search and find existing knowledge.
Jon Summers said:but no method or constructor to set the schema.
Do not look at it (over)complicated ;-)
Just create the link and pass URL to be used to construct the link. When API is not able to recognize the schema (because URL is e.g. "place line" and not "ustnkeyin:place line"), the created link has unrecognized schema, which can be used to check whether the link was created as expected.
Regards,
Jon Summers said:There is a method to read the schema of a DgnURLLink, but no method or constructor to set the schema
Yongan.Fu provided this example...
auto leaf = DgnLinkManager::CreateLink(status, DGNLINK_TYPEKEY_URLLink)
Where DGNLINK_TYPEKEY_XXX is a string found in header file DgnLinkManager.h. The API uses one specification (a const WChar string) when creating a DgnLink and another specification (enum Schema) when reading its schema (Schema DgnURLLink.GetSchema()).
DGNLINK_TYPEKEY_XXX
DgnLinkManager.h
const WChar
DgnLink
enum Schema
Schema DgnURLLink.GetSchema()