custom scripts

custom scripts

Anonymous
Not applicable
1,819 Views
6 Replies
Message 1 of 7

custom scripts

Anonymous
Not applicable

I am trying/ hoping to export an Inventor parametric model into a python script for import into Plant3D catalogs as a template item.

 

Typically we use the block method and command PLANTPARTCONVERT, but we would like to skip these steps and script it into Plant.

 

Does anyone know how to achieve this?, I have managed to generate a python script from an Inventor part but Plant does not understand the code/ language/ terminology assigned from within Inventor.

0 Likes
1,820 Views
6 Replies
Replies (6)
Message 2 of 7

Scott.Hallmark
Advocate
Advocate

Will you post the script generated from an Inventor model?

** If my reply resolves this issue, please choose Accept Solution **
Scott Hallmark, Design Specialist | Fluor Corporation
Inventor and AutoCAD Certified Professional, Autodesk Certified Instructor | My Plant3D Notes | AU Speaker | ROLL TIDE!
0 Likes
Message 3 of 7

Anonymous
Not applicable

any feedback/ ideas to our predicament ?.

 

Thanks Scott


@Scott.Hallmark wrote:

Will you post the script generated from an Inventor model?


 

0 Likes
Message 4 of 7

Scott.Hallmark
Advocate
Advocate

I was hoping to see the script generated from the inventor file, if possible.  If you do not want to post here, you can email it to me.  shallmark@asti.com

** If my reply resolves this issue, please choose Accept Solution **
Scott Hallmark, Design Specialist | Fluor Corporation
Inventor and AutoCAD Certified Professional, Autodesk Certified Instructor | My Plant3D Notes | AU Speaker | ROLL TIDE!
0 Likes
Message 5 of 7

Anonymous
Not applicable

I have managed to write a script for Plant to generate a template ball valve:

 

from aqa.math import *

from varmain.valvsub.cpv_util import *

from varmain.primitiv import *

from varmain.var_basic import *

from varmain.custom import *

import os

import sys

sys.path.append(os.path.normpath(sys.PnP3dNativeContentCustomScriptsPath))

from Template_Ball_Valve import *

 

@Anonymous(Group="CustomValve", FirstPortEndtypes="PL", Ports=2, TooltipShort="Template Ball Valve", TooltipLong="Template Ball Valve", LengthUnit="in")

@group("MainDimensions")

@param(DIA=LENGTH, TooltipShort="Pipe Diameter")

@param(OAL=LENGTH, TooltipShort="Overall Length")

@param(STEM=LENGTH, TooltipShort="STEM HEIGHT")

@param(LVRLGTH=LENGTH, TooltipShort="LEVER LENGTH")

 

def Template_Ball_Valve (s, DIA=1.315, OAL=6, STEM=5, LVRLGTH=5, ID='valve_pythonpath', **kw):

 

                o1=CYLINDER(s, R=DIA*0.5, H=OAL, O=(DIA*0.5)-0.125).rotateY(90).translate((0, 0, 0))

                o2=CYLINDER(s, R=DIA, H=OAL*0.5, O=(DIA*0.5)-0.125).rotateY(90).translate((OAL*.25, 0, 0))

                o3=CYLINDER(s, R=DIA*0.2, H=STEM, O=0.0).translate((OAL*.5, 0, 0))

                o4=BOX(s, L=LVRLGTH, W=0.25, H=0.75).rotateY(0).translate((OAL*0.5, LVRLGTH*0.5, STEM-0.125))

                o5=BOX(s, L=LVRLGTH, W=0.25, H=0.75).rotateZ(90).translate((0.5*(OAL-LVRLGTH), 0, STEM-0.125))

 

                s.setPoint((0, 0, 0), (-1, 0, 0))

                s.setPoint((OAL, 0, 0), (1, 0, 0))

 

How can I add in extra features (shapes) such that the valve generated appears like the images below, mainly the "pie" shape, bolt ears and hex socket features

 

valve top view.jpgvalve side view.jpgvalve iso view.jpg

0 Likes
Message 6 of 7

Anonymous
Not applicable

I would personally try not to show so much detail, like fillets, hex shapes, etc.  The more detail shown, the more resources are used.  Find the following PDF from AU2011 that shows how to add primitive shapes in the PY.  

 

http://aucache.autodesk.com/au2011/sessions/4214/datasets/v1_PD4214-L_Radhakrishnan_AnnexB_Custom%20...

 

In that same PDF, you will find and likely have to do a variety of uniteWith and subtractFrom instructions to get it close to this.  We (Applied Software) can provide this as a paid service for you unless you are just wanting to learn how to do it.

Message 7 of 7

Anonymous
Not applicable
Scott,
Ideally I/ we would like to learn how to do this.
That said, IF we can pay for your service what is the cost and timeframe to produce a script for such a part?.
Thanks,
Neil
0 Likes