Hello all,
I have been searching here in the forum for a long time but unfortunately have not yet found a solution.
Is there a way to access the iProperties/project via the API and query the values?
I have the following code but I don't know which function I can use to query it.
Row 22 I try to search for it but it doesn'twork.
private static void GetOccurences(ComponentOccurrences componentOccurrences, int level, IProgressTracker tracker, CancellationToken token)
{
double count = 0;
int numberOfAllObjects = componentOccurrences.Count;
foreach (ComponentOccurrence occurence in componentOccurrences)
{
Functions.ProgressBar.CancelJob(tracker, token);
//MassProperties
var massProperties = occurence.MassProperties;
//RefKey
byte[] myRefKey = { };
occurence.GetReferenceKey(ref myRefKey, _createKeyContext);
listRefKeys.Add(_documentAssembly.ReferenceKeyManager.KeyToString(myRefKey)); //RefKEy kontrollieren
//GetProperties
var name = occurence.ItemByName["Description"];
}
}
Many thanks for your help.
Greetings
Chris
Solved! Go to Solution.
Hello all,
I have been searching here in the forum for a long time but unfortunately have not yet found a solution.
Is there a way to access the iProperties/project via the API and query the values?
I have the following code but I don't know which function I can use to query it.
Row 22 I try to search for it but it doesn'twork.
private static void GetOccurences(ComponentOccurrences componentOccurrences, int level, IProgressTracker tracker, CancellationToken token)
{
double count = 0;
int numberOfAllObjects = componentOccurrences.Count;
foreach (ComponentOccurrence occurence in componentOccurrences)
{
Functions.ProgressBar.CancelJob(tracker, token);
//MassProperties
var massProperties = occurence.MassProperties;
//RefKey
byte[] myRefKey = { };
occurence.GetReferenceKey(ref myRefKey, _createKeyContext);
listRefKeys.Add(_documentAssembly.ReferenceKeyManager.KeyToString(myRefKey)); //RefKEy kontrollieren
//GetProperties
var name = occurence.ItemByName["Description"];
}
}
Many thanks for your help.
Greetings
Chris
Solved! Go to Solution.
Solved by JelteDeJong. Go to Solution.
Is this what you are looking for:
/*
AssemblyDocument document = (AssemblyDocument)ThisDoc.Document;
ComponentOccurrence componentOccurrences = document.ComponentDefinition.Occurrences[1];
*/
Document refDoc = (Document)componentOccurrences.Definition.Document;
// property (set) names can be found on:
// https://modthemachine.typepad.com/my_weblog/2010/02/accessing-iproperties.html
PropertySet propertySet = refDoc.PropertySets["Design Tracking Properties"];
Property property = propertySet["Project"];
string project = property.Value as string;
System.Diagnostics.Debug.WriteLine(project);
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com
Is this what you are looking for:
/*
AssemblyDocument document = (AssemblyDocument)ThisDoc.Document;
ComponentOccurrence componentOccurrences = document.ComponentDefinition.Occurrences[1];
*/
Document refDoc = (Document)componentOccurrences.Definition.Document;
// property (set) names can be found on:
// https://modthemachine.typepad.com/my_weblog/2010/02/accessing-iproperties.html
PropertySet propertySet = refDoc.PropertySets["Design Tracking Properties"];
Property property = propertySet["Project"];
string project = property.Value as string;
System.Diagnostics.Debug.WriteLine(project);
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com
Thank you very much for your answer.
I have just tested it in the way you suggested.
In "property" I get the following values displayed.
However, I would like to read out the designation (Beschreibung) as shown in the following picture.
I hope it is clear what I mean by this. 🙂
Thank you very much for your help.
Greetings
Chris
Thank you very much for your answer.
I have just tested it in the way you suggested.
In "property" I get the following values displayed.
However, I would like to read out the designation (Beschreibung) as shown in the following picture.
I hope it is clear what I mean by this. 🙂
Thank you very much for your help.
Greetings
Chris
Have a look at this article.
https://modthemachine.typepad.com/my_weblog/2010/02/accessing-iproperties.html
at bottom you will find a table with the propery(set) names that you can use.
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com
Have a look at this article.
https://modthemachine.typepad.com/my_weblog/2010/02/accessing-iproperties.html
at bottom you will find a table with the propery(set) names that you can use.
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com
Thank you very much now it works! 🙂
Thank you very much now it works! 🙂
Can't find what you're looking for? Ask the community or share your knowledge.