Custom Pipe Support Python Script Wierdness

Custom Pipe Support Python Script Wierdness

Anonymous
Not applicable
5,293 Views
23 Replies
Message 1 of 24

Custom Pipe Support Python Script Wierdness

Anonymous
Not applicable

I created a custom python script for a variable pipe shoe. Which works well, except for the fact that the shoe is being placed perpendicular to the pipe. And I can't change its orientation.........because when I attempt to rotate the shoe the Z Axis is actually called from the connecting pipe.

 

This is the script:

 

import aqa.math
import math
from varmain.primitiv import *
from varmain.var_basic import *
from varmain.custom import *
 
@Anonymous(Group="Support", TooltipShort="APA SH01 Pipe Shoe Variable", TooltipLong="APA SH01 Pipe Shoe Variable", LengthUnit="mm",Ports="1")
@matthias_hein("MainDimensions")
@param(L1=LENGTH, TooltipShort="Shoe Pad Length", TooltipLong="Shoe Pad Length", Ask4Dist=True)
@param(A1=LENGTH, TooltipShort="Shoe Pad Width", TooltipLong="Shoe Pad Width")
@param(T1=LENGTH, TooltipShort="Shoe Pad Thickness", TooltipLong="Shoe Pad Thickness")
@param(L2=LENGTH, TooltipShort="Shoe Web Length", TooltipLong="Shoe Web Length")
@param(H1=LENGTH, TooltipShort="Shoe Web Thickness", TooltipLong="Shoe Web Thickness")
@param(B=LENGTH, TooltipShort="Shoe Web Height", TooltipLong="Shoe Web Height")
@param(P1=LENGTH, TooltipShort="Main Piperun Diameter", TooltipLong="Main Piperun Diameter")
@matthias_hein(Name="meaningless enum")
@enum(1, "align X")
@enum(2, "align Y")
@enum(3, "align Z")
#--------------------------------------------------------
#(arxload "PnP3dACPAdapter")
#(TESTACPSCRIPT "APASH01" "L1" "300" "A1" "140" "T1" "10" "L2" "300" "H1" "10" "B" "100" "P1" "114")
def APASH01(s, L1 = 300.0, A1 = 140.0, T1 = 10.0, L2 = 300.00, H1 = 10.0, B = 100.0, P1 = 114.3, ID = 'APASH01', **kw):
# create the shoe flange
#   o1 = BOX(s, L=L1, W=A1, H=T1).rotateY(90).translate((0.0, 0.0, - T1 / 2.0))
    BOX(s, L=L1, W=A1, H=T1).rotateY(90).rotateZ(90).translate((0.0, 0.0, - T1 / 2.0))
#--------------------------------------------------------
# create the shoe web
#    o2 = BOX(s, L=L2, W=B, H=H1)
    shoeheight = B - H1
    inspoint = shoeheight + (P1/2)
    BOX(s, L=L2, W=shoeheight, H=H1).rotateY(0).rotateZ(90).translate((0.0, 0.0, shoeheight / 2.0))
#    o1.unitWith(o2)
#    o2.erase()
    s.setPoint((0.0, 0.0, inspoint), (-1.0, 0.0, 0.0))

 

 

And here is what happens. Shoe in the red box has been placed from the Pipe Support Palette (Script based).

The Cyan coloured shoe was created using the Testacpscript (found in the script body above).

 

APASH01.PNG

 

I've never had this or seen this before. Has anyone seen this behaviour or know of a solution.

 

Cheers,

 

Steve

Reply
Reply
0 Likes
5,294 Views
23 Replies
Replies (23)
Message 21 of 24

ZZikic
Advocate
Advocate

@matthias.hein is the original author.  Your custom scripts should not include his calls.

Replace the @matthias.hein("MainDimensions") with @group("MainDimensions")

As for the following lines:

@matthias.hein(Name="meaningless enum")
@enum(1, "align X")
@enum(2, "align Y")
@enum(3, "align Z")

These are not required and I suggest removing them.

 

Reply
Reply
0 Likes
Message 22 of 24

mlandmann
Participant
Participant

This is an excellent explanation. How do you do step 2? 

 

2. Load the "PnP3dACPAdapter.arx" from within Plant 3D.

 

Thanks so much. 

Reply
Reply
0 Likes
Message 23 of 24

mlandmann
Participant
Participant

I cannot get the test script to run. Nothing happens in plant 3d. 

Reply
Reply
0 Likes
Message 24 of 24

theshoaib.mughal
Advocate
Advocate

Greetings.

 

The supports in the p3D are for piping compinents only. I have written the code to create customized cable tray components and they are working fine. I'd now like to create custom supports for these cable trays as I am encountring certain problems with existing flat steel supports. 

1. they assume that my supports is a pipe (which they should as p3d is for piping and i assigned a matching pipe OD to every tray component). But this is causing the supports to suspend slightly below the tray exactly at a distance equal to corresponding pipe

2. There aren't versatile supports in the built-in catalog

 

So, I was thinking to create my own. Now a couple of questions comes to mind. Firstly, is the support coding same as components or do it require special tinkering? Secondly, what about the ports? I see that in every support script above, the port coubt is always 1. And the port vector doesn't make sense to me. "s.setPoint((port coordinate), (port direction vector))" so what do we do here; the supports connects along the path of the components and the ports on components are at the extreme ends. Without anything to anchor with, how will the support attach with component and move along the length if required. 

 

Could you please guide me

Reply
Reply
0 Likes