You are on page 1of 5

21/01/2017

Modify"CreateTube&PipeRun"dialogcontentManufacturingDevBlog

ManufacturingDevBlog
(http://adndevblog.typepad.com/manufacturing/)

TheresourceforsoftwaredevelopersworkingwithDesign,LifecycleandSimulationtechnologiesfromAutodesk.

02/13/2016

Modify"CreateTube&PipeRun"dialogcontent
ByAdamNagy(http://adndevblog.typepad.com/manufacturing/adamnagy.html)
Whenyouswitchto"Tube&Pipe"environment...

(http://adndevblog.typepad.com/.a/6a0167607c2431970b01bb08b9df47970dpopup)
...thenbeforethe"CreateTube&PipeRun"dialogpopsup,theOnPopulateFileMetadataeventoftheFileUIEventsobjectwillbecalled,whichwecanhandle.Tohandleevents
weneedaclass,soIcreatedonecalled"clsEvents"inVBA:

(http://adndevblog.typepad.com/.a/6a0167607c2431970b01bb08bb7f06970dpopup)
'CodeofclsEventsClass
DimWithEventsoFEAsFileUIEvents

PrivateSubClass_Initialize()
SetoFE=ThisApplication.FileUIEvents
EndSub

PrivateSuboFE_OnPopulateFileMetadata(_
ByValFileMetadataObjectsAsObjectsEnumerator,_
ByValFormulaeAsString,_
ByValContextAsNameValueMap,_
HandlingCodeAsHandlingCodeEnum)

'UnfortunatelytheContextisnotfilledwithinfo
'incaseoftheTube&Pipedialog
'sowecanonlyfigureoutifthiseventwas
'firedbyitthroughcheckingthemetadata

'Ifnotthecorrectamountofdata,we'redone
IfFileMetadataObjects.Count<>2ThenExitSub

Dimfmd1AsFileMetadata
Setfmd1=FileMetadataObjects(1)

'Ifthesuggestedassemblyfilenamedoesnot
'contain"TubeandPipeRuns",we'redone
IfInStr(1,fmd1.FileName,"TubeandPipeRuns")<1ThenExitSub

Dimfmd2AsFileMetadata
Setfmd2=FileMetadataObjects(2)

fmd1.FullFileName="C:\temp\myruns\runs.iam"
fmd2.FullFileName="C:\temp\myruns\myrun1\run1.iam"

HandlingCode=kEventHandled
EndSub
Inordertostartlisteningtothiseventweneedtoinstantiateourclassandkeepaglobalreferencetoit.Thiscouldbedonee.g.insideaVBAmodule.Ifyoualsowantyourcommand
toautomaticallystarttheTube&Pipeenvironmentthenyoucandoitasshowninthebelowcode,basedonthisblogpost:
http://modthemachine.typepad.com/my_weblog/2009/03/runningcommandsusingtheapi.html(http://modthemachine.typepad.com/my_weblog/2009/03/runningcommands

http://adndevblog.typepad.com/manufacturing/2016/02/modifycreatetubepiperundialogcontent.html

1/5

21/01/2017

Modify"CreateTube&PipeRun"dialogcontentManufacturingDevBlog

usingtheapi.html)
'Globalreferencetotheeventlistener
DimoEventsAsclsEvents

SubStartListeningToEvents()
SetoEvents=NewclsEvents

'Uncommentbelowcodeifyouwanttostartthe
'Tube&Pipeenvironment
'DimoCDsAsControlDefinitions
'SetoCDs=ThisApplication.CommandManager.ControlDefinitions

'DimoCDAsControlDefinition
'SetoCD=oCDs("HSL:Piping:CreatePipeRun")

'CalloCD.Execute
EndSub
Andthischangewillbereflectedinthedialog:

(http://adndevblog.typepad.com/.a/6a0167607c2431970b01b7c8151256970bpopup)
IfweclickOK,weendupwithamodellikethis:

(http://adndevblog.typepad.com/.a/6a0167607c2431970b01b8d19f36cf970cpopup)
YoucanalsohookupyourVBAmacrotoabuttonintheUIfollowingthisblogpost:
http://modthemachine.typepad.com/my_weblog/2010/03/buttonsforvbamacrosintheribbonuserinterface.html
(http://modthemachine.typepad.com/my_weblog/2010/03/buttonsforvbamacrosintheribbonuserinterface.html)
Postedat08:38AMinAdamNagy(http://adndevblog.typepad.com/manufacturing/adamnagy/),Inventor(http://adndevblog.typepad.com/manufacturing/inventor/)|Permalink
(http://adndevblog.typepad.com/manufacturing/2016/02/modifycreatetubepiperundialogcontent.html)
(http://twitter.com/share?url=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F02%2Fmodifycreatetubepiperundialog
content.html&text=Modify%20%22Create%20Tube%20%26%20Pipe%20Run%22%20dialo...)

(https://plus.google.com/share?

url=http://adndevblog.typepad.com/manufacturing/2016/02/modifycreatetubepiperundialogcontent.html)

(http://www.facebook.com/sharer.php?
u=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F02%2Fmodifycreatetubepiperundialogcontent.html)

Comments
http://adndevblog.typepad.com/manufacturing/2016/02/modifycreatetubepiperundialogcontent.html

2/5

21/01/2017

Modify"CreateTube&PipeRun"dialogcontentManufacturingDevBlog

Comments
Adrian(http://blog.adssol.com)said...

Adam,
You'vegottogiveusmoregrip.Howdoweusethis?ChangingthedefaultFilenamesandLocationforT&Pissomethingwe'vebeenaskingforalongtime.
Reply
02/15/2016at12:15AM(http://adndevblog.typepad.com/manufacturing/2016/02/modifycreatetubepiperundialogcontent.html#comment
6a0167607c2431970b01b8d19fd06a970c)
AdamNagy(http://profile.typepad.com/1236098880s16462)saidinreplytoAdrian(http://blog.adssol.com)...

HiAdrian,
Better?:)
Reply
02/16/2016at08:43AM(http://adndevblog.typepad.com/manufacturing/2016/02/modifycreatetubepiperundialogcontent.html#comment
6a0167607c2431970b01b8d1a079a4970c)
Adrian(http://blog.adssol.com)said...

Better?
Idon'tknowyet.Iwillhavetolearnhowtoprogramandthenwilltestthisout.Iwashoppingsomethingmorelike:
addthiscodetotheTubeandPipeRoutes.iamtemplateanditwillfireupautomaticallywhenyoustartT&P.
or
CreateanewbuttonandusethecodetoinitiatetheT&Penvironmentwithit.
IguessfornowIneedtowaitforawizardtocomealongandshowushowtodothat,oraskintheInventorcustomizationforum.
Thanks.
Reply
02/17/2016at03:04AM(http://adndevblog.typepad.com/manufacturing/2016/02/modifycreatetubepiperundialogcontent.html#comment
6a0167607c2431970b01bb08bb7a39970d)
AdamNagy(http://profile.typepad.com/1236098880s16462)saidinreplytoAdrian(http://blog.adssol.com)...

Ohh,Isee.
OK,Iaddedsomemoreinfowhichcouldbeuseful.

Reply
02/17/2016at04:37AM(http://adndevblog.typepad.com/manufacturing/2016/02/modifycreatetubepiperundialogcontent.html#comment
6a0167607c2431970b01b8d1a0d582970c)
Commentbeloworsigninwith Typepad(http://www.typepad.com/sitelogin?uri=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F02%2Fmodifycreate
tubepiperundialog
content.html&fp=4a85d96b4a7d915d0003be954c177d44&view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&post_uri=http://adndevblog.typepad.com/manufacturing/2016/
createtubepiperundialogcontent.html) Facebook(http://www.typepad.com/sitelogin?
uri=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F02%2Fmodifycreatetubepiperundialog
content.html&fp=4a85d96b4a7d915d0003be954c177d44&view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&service=facebook&post_uri=http://adndevblog.typepad.com/ma
createtubepiperundialogcontent.html) Twitter(http://www.typepad.com/sitelogin?
uri=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F02%2Fmodifycreatetubepiperundialog
content.html&fp=4a85d96b4a7d915d0003be954c177d44&view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&service=twitter&post_uri=http://adndevblog.typepad.com/man
createtubepiperundialogcontent.html) Google+(http://www.typepad.com/sitelogin?
uri=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F02%2Fmodifycreatetubepiperundialog
content.html&fp=4a85d96b4a7d915d0003be954c177d44&view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&service=gplus&post_uri=http://adndevblog.typepad.com/manu
createtubepiperundialogcontent.html)andmore...(http://www.typepad.com/sitelogin?
uri=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F02%2Fmodifycreatetubepiperundialog
content.html&fp=4a85d96b4a7d915d0003be954c177d44&view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&service=openid&post_uri=http://adndevblog.typepad.com/man
createtubepiperundialogcontent.html)

http://adndevblog.typepad.com/manufacturing/2016/02/modifycreatetubepiperundialogcontent.html

3/5

21/01/2017

Modify"CreateTube&PipeRun"dialogcontentManufacturingDevBlog

(URLsautomaticallylinked.)

Emailaddressisnotdisplayedwithcomment.

Name
EmailAddress
WebSiteURL
Post Preview

(http://www.typepad.com/)
ManufacturingDevBlog(http://adndevblog.typepad.com/manufacturing/)

http://adndevblog.typepad.com/manufacturing/2016/02/modifycreatetubepiperundialogcontent.html

4/5

21/01/2017

Modify"CreateTube&PipeRun"dialogcontentManufacturingDevBlog

http://adndevblog.typepad.com/manufacturing/2016/02/modifycreatetubepiperundialogcontent.html

5/5

You might also like