Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

[C++ SDK Engineer Content] 'Locked' property always return true/locked

$
0
0

Hi Experts,

I am using the Microstation C++ sdk to query model's engineer contents, one issue I notice is the 'Locked' property always return true/locked even I saw the element is `unlocked` in microstation application, please see the image:

And here is the code I used to query out all ECInstasnce properites:

	DgnFilePtr dgnFile = OpenDgnFile(filename, DgnFileOpenMode::ReadOnly);
    DgnModelR dgnModel = GetDefaultModel(*dgnFile);
    DgnECManagerR dgnECManager = DgnECManager::GetManager();

    // Whenever we query for instances, we need to supply a "scope" for the query...
    // Do we want to query in just one model, or in a model plus all of its attachments?
    bool includeReferenceAttachments = true;
    FindInstancesScopePtr scope = FindInstancesScope::CreateScope(*(dgnFile.get()), FindInstancesScopeOption(DgnECHostType_FileAll, includeReferenceAttachments));

    /////////////////////////////////////////////////////////////////////////////
    // First, we "Find all ECInstances in this model (and its referenced models)"
    ECQueryPtr  findAll = ECQuery::CreateQuery(ECQUERY_PROCESS_SearchAllClasses); // Finds ALL ECInstances, regardless of their ECClass

    for each (DgnECInstancePtr instance in dgnECManager.FindInstances(*scope, *findAll))
    {
		DgnElementECInstancePtr elementInstance = instance.GetAsElementInstance();
		if (elementInstance.IsValid())
		{
			ECClassCR elementClass = elementInstance->GetAsElementInstance()->GetClass();
			ECPropertyIterable iter = elementClass.GetProperties();


			ECPropertyIterable::const_iterator cit = iter.begin();
			while (cit != iter.end())
			{
				ECPropertyP p = *cit;

				ECValue v;
				if (SUCCESS == pIECInstance->GetValue(v, p->GetName().c_str()))
				{
					wprintf(L"\n    Property name =%ls", p->GetName().c_str());
					if (v.IsBoolean()) // print out property name and it's values.
					{
						wprintf(L" value=%d, ", v.GetBoolean());
					}
					// else if () other types.
				}
			}
		}
    }

And here is the model I used for testing.

(Please visit the site to view this file)

Could you please help take a look? 

Thanks

Danny


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>