AutoCAD Plant 3D Forum
Welcome to Autodesk’s AutoCAD Plant 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Plant 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Wrong size when creating pipes by API

13 REPLIES 13
Reply
Message 1 of 14
alexandrescoelho
802 Views, 13 Replies

Wrong size when creating pipes by API

Hello everybody,

I've been testing the sample which came with Plant3D SDK (Plant SDK 2013\Samples\Piping\CreatePipeline) for modeling from a .NET assembly. When execute with NETLOAD and then CREATEPIPE I can see all components created on current drawing. The problem is about size for those components. If you check the image, components created from dll is smaller than they should be. Beside a pipe with 10" (red) created from DLL there is a pipe with 10" too (red), but it was created through the plant3d interface. So the question is, why size is different when creating components by .NET dll ? What I have to do to get the right size? Anyone else had same problem? 

Thanks

13 REPLIES 13
Message 2 of 14

Project units?



Tomislav Golubovic
Technical Specialist - Plant and Infrastructure
Autodesk Australia / New Zealand
Autodesk, Inc.
Autodesk ANZ YouTube Channel
Message 3 of 14

Well, I tried to change while creating pipes but no success. After I tried to change at project settings, no success either. 

Any sugestion?

Message 4 of 14

I meant create a new project with Metric units, or if you have already, try it in a project with Imperial units.



Tomislav Golubovic
Technical Specialist - Plant and Infrastructure
Autodesk Australia / New Zealand
Autodesk, Inc.
Autodesk ANZ YouTube Channel
Message 5 of 14

Tried it already. First only metric, second imperial and finally mixed metric and imperial. In all cases, if pipe were created programmatically size is lower them it should be, by the other hand if create through route pipe with same size pipe was created is right. I'm not sure if can I post my test project attached to this thread.    

Message 6 of 14

Add the second line when you create the new object.

part = new Pipe();
part.OuterDiameter = (double)sPart.PropValue("MatchingPipeOD");
Dave Wolfe
Isaiah 57:15



Tips and Tricks on our blog: ASTI blog
EXPERT ELITE MEMBER
Plant 3D Wish list
Message 7 of 14

Same problem, I tried to set other diameters from available diameter range but neither diameter was created with rigth visual size. Any other suggestion?

Message 8 of 14

No, this is what fixed the issue for me.  Just make sure the spec part you looked up has the matchingpipeod that you expect, before setting the outer diameter.

Dave Wolfe
Isaiah 57:15



Tips and Tricks on our blog: ASTI blog
EXPERT ELITE MEMBER
Plant 3D Wish list
Message 9 of 14

Dave,

 

Checking carefully, I found out that this problem occurs only when plant3d unit project is millimiter or mixed. For imperial it works fine. It's seems a issue to set which unit is being used for creating pipe. Is there any way to set which unit should be used while creating components? 

I've already tried this part.PartSizeProperties.NeedUnitScale(Units.Inch) but no sucess.

 

Thank you

 

Best regards

Message 10 of 14

Did you try setting Units.Metric?  The units is the target units you want.  I did that and I think it fixed my problem.

Dave Wolfe
Isaiah 57:15



Tips and Tricks on our blog: ASTI blog
EXPERT ELITE MEMBER
Plant 3D Wish list
Message 11 of 14

Should I set Units at project configuration or at sample code? Could you post a piece of code?

 

Best regards

Message 12 of 14

I'm not sure if you mean this part.PartSizeProperties.NeedUnitScale(Units.Mm); but Units.Mm does not solve the problem
Message 13 of 14

To be honest, I'm not sure what fixed it.  I changed that and it started drawing right again, but I don't know why. Incidentally, I'm using Metric specs in an imperial project drawing in a model that's in millimeters. 

 

No clue why it's working.  I do have the UNITS variable set to mm. But I don't know if that's it or not.

 

For a while it didn't work today, but now it does...

Dave Wolfe
Isaiah 57:15



Tips and Tricks on our blog: ASTI blog
EXPERT ELITE MEMBER
Plant 3D Wish list
Message 14 of 14
dave.wolfe
in reply to: dave.wolfe

FINALLY got this figured out.

 

You can retrieve the current drawing insertion settings via INSUNITS.

 

You'll have to create a method to determine which unit type you want to use, but the method you need to use is from the ContentManager.

 

When you use the GetSymbol() method from the ContentManager, one of the overrides includes passing in a scale from Autodesk.ProcessPower.PartsRepository.Units enum. When you specify the scale, the symbol gets created scaled to match.

Dave Wolfe
Isaiah 57:15



Tips and Tricks on our blog: ASTI blog
EXPERT ELITE MEMBER
Plant 3D Wish list

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost