Pipe length ignored when set through API

Pipe length ignored when set through API

Anonymous
Not applicable
475 Views
3 Replies
Message 1 of 4

Pipe length ignored when set through API

Anonymous
Not applicable

I can change the length of a pipe by right-clicking it in the assembly tree, selecting "Change Size", and setting the PL field. However, when I do the same thing using the API, nothing happens and the pipe stays the same length.

 

// pdoc is the document for the pipe part
foreach (Inventor.PropertySet pset in pdoc.PropertySets)
{
    if (pset.Name != "Inventor User Defined Properties") continue;
    
    foreach(Inventor.Property p in pset)
    {
        Console.WriteLine(p.Name);
        Console.WriteLine(p.Value);
        p.Value = "20.000 in";
        Console.WriteLine(p.Value);
    }
}

 

I can see the value of both L and PL change from "10.000 in" to "20.000 in", but after the script finishes the pipe is still 10 in long.

0 Likes
Accepted solutions (1)
476 Views
3 Replies
Replies (3)
Message 2 of 4

marcin_otręba
Advisor
Advisor
Accepted solution

when yoiu update any parameter inside part you must update your geometry. odoc.Update

But in your code you change value of iproperty ?  it will do nothing with your geometry. You must change parameter value. doc.componentdefinition.parameters...

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 3 of 4

Anonymous
Not applicable

Changing the values in doc.ComponentDefinition.Parameters and calling doc.Update() worked, thank you!

 

What are the properties for though, if they don't change the drawing?

0 Likes
Message 4 of 4

marcin_otręba
Advisor
Advisor

trough iptoperties you can easy share information about your files. for example you can export parameters to i properties and use it in bom-s, drawings, exports etc.

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes