You are on page 1of 4

21/01/2017

PromptedEntry/PromptedTexts/PromptStringsManufacturingDevBlog

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

TheresourceforsoftwaredevelopersworkingwithDesign,LifecycleandSimulationtechnologiesfromAutodesk.

03/02/2016

PromptedEntry/PromptedTexts/PromptStrings
ByAdamNagy(http://adndevblog.typepad.com/manufacturing/adamnagy.html)
Youcanaddpromptedtexttoatitleblockorborderbyplacinginstancesof"PromptedEntry"inthem:

(http://adndevblog.typepad.com/.a/6a0167607c2431970b01b8d1a75cfe970cpopup)
Whenyouareinsertingsuchatitleblockorborder(oranewsheetwithoneofthose)thenyou'llbepromptedwithadialogcalled"PromptedTexts"toprovidethevaluesforthem:

(http://adndevblog.typepad.com/.a/6a0167607c2431970b01b7c81d3d01970bpopup)
Whencreatinganewsheet,addinganewtitleblockorborder,youcanspecifythestringsthatshouldbeusedforthePromptedEntry'sbyfillingin
theTitleBlockPromptStrings/BorderPromptStringsvariablesinSheets.AddUsingSheetFormatfunction,orPromptStringsvariableinSheet.AddBorderand
Sheet.AddTitleBlockfunctions.
TheInventorAPIhelpfilehasasampleforsettingthePromptedEntry'sinsidetheSheet.AddTitleBlockfunction.Youhavetousetheothertwofunctionsinasimilarfashion.
Ifyouwanttodothingsdynamically,i.e.yourfunctionissupposedtoworkwithmultipledifferenttitleblockandborderdefinitionsandyouhavetocheckwhatPromptedEntry's
theycontain,thenthisblogpost(http://adndevblog.typepad.com/manufacturing/2012/05/readpromptedentrythroughcode.html)willhelp.
Inmydrawingtheactivesheethasmycustomtitleblockandborder:

http://adndevblog.typepad.com/manufacturing/2016/03/promptedentrypromptedtextspromptstrings.html

1/4

21/01/2017

PromptedEntry/PromptedTexts/PromptStringsManufacturingDevBlog

(http://adndevblog.typepad.com/.a/6a0167607c2431970b01b7c81d5b25970bpopup)
ThisVBAcodecancreateanewsheetwiththesametitleblockandborderthattheactivesheethas,withoutInventorpoppingupthe"PromptedTexts"dialog:

http://adndevblog.typepad.com/manufacturing/2016/03/promptedentrypromptedtextspromptstrings.html

2/4

21/01/2017

PromptedEntry/PromptedTexts/PromptStringsManufacturingDevBlog

'Beforerunningthiscode,addreferenceto
'"MicrosoftXML,v6.0"inthisVBAproject
FunctionGetPromptedEntryNames(skAsSketch)AsString()
OnErrorResumeNext
Dimnames()AsString
DimtbAsTextBox
ForEachtbInsk.TextBoxes
DimxmlAsDOMDocument
Setxml=NewDOMDocument
'FormattedTextmightnotbeavailableon
'allTextBox,that'swhyusing
'errorhandling
Callxml.loadXML(tb.FormattedText)

'Lookforpromptedentry
DimnodeAsIXMLDOMNode
Setnode=xml.selectSingleNode("Prompt")
IfNotnodeIsNothingThen
If(Notnames)=1Then
ReDimnames(0)AsString
Else
ReDimPreservenames(UBound(names)+1)AsString
EndIf

names(UBound(names))=node.text
EndIf
Next
OnErrorGoTo0

GetPromptedEntryNames=names
EndFunction

SubSetValueBasedOnName(strings()AsString)
DimiAsInteger
Fori=0ToUBound(strings)
DimsAsString:s=strings(i)
Ifs="MyBorderPrompt"Ors="MyTitlePrompt"Then
strings(i)="MyValue"
Else
strings(i)="Dunno"
EndIf
Next
EndSub

SubAddNewSheet()
DimdwgAsDrawingDocument
Setdwg=ThisApplication.ActiveDocument

DimshAsSheet
Setsh=dwg.ActiveSheet

'ArraysforthePromptedEntry's
DimpsTB()AsString
DimpsB()AsString

psTB=GetPromptedEntryNames(sh.TitleBlock.Definition.Sketch)
psB=GetPromptedEntryNames(sh.Border.Definition.Sketch)

'Fillthemwithvaluesbasedonourlogic
CallSetValueBasedOnName(psTB)
CallSetValueBasedOnName(psB)

'Createanewformatbasedonactivesheet
DimsfAsSheetFormat
Setsf=dwg.SheetFormats.Add(sh,"Mine")

'Createanewsheet
DimsAsSheet
Sets=dwg.Sheets.AddUsingSheetFormat(_
sf,,"Mysheet",,psTB,psB)

'Ifyoudon'twanttokeeptheformatyoucandeleteit
Callsf.Delete
EndSub

http://adndevblog.typepad.com/manufacturing/2016/03/promptedentrypromptedtextspromptstrings.html

3/4

21/01/2017

PromptedEntry/PromptedTexts/PromptStringsManufacturingDevBlog

Postedat08:02AMinAdamNagy(http://adndevblog.typepad.com/manufacturing/adamnagy/),Inventor(http://adndevblog.typepad.com/manufacturing/inventor/)|Permalink
(http://adndevblog.typepad.com/manufacturing/2016/03/promptedentrypromptedtextspromptstrings.html)
(http://twitter.com/share?url=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F03%2Fpromptedentrypromptedtexts
promptstrings.html&text=Prompted%20Entry%20%2F%20Prompted%20Texts%20%2F%20Pr...)

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

url=http://adndevblog.typepad.com/manufacturing/2016/03/promptedentrypromptedtextspromptstrings.html)

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

Comments

Commentbeloworsigninwith Typepad(http://www.typepad.com/sitelogin?uri=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F03%2Fpromptedentry
promptedtexts
promptstrings.html&fp=2d2d55f0075054c2dacfbfb290dae2d3&view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&post_uri=http://adndevblog.typepad.com/manufacturing/2
entrypromptedtextspromptstrings.html) Facebook(http://www.typepad.com/sitelogin?
uri=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F03%2Fpromptedentrypromptedtexts
promptstrings.html&fp=2d2d55f0075054c2dacfbfb290dae2d3&view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&service=facebook&post_uri=http://adndevblog.typepad.com
entrypromptedtextspromptstrings.html) Twitter(http://www.typepad.com/sitelogin?
uri=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F03%2Fpromptedentrypromptedtexts
promptstrings.html&fp=2d2d55f0075054c2dacfbfb290dae2d3&view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&service=twitter&post_uri=http://adndevblog.typepad.com/
entrypromptedtextspromptstrings.html) Google+(http://www.typepad.com/sitelogin?
uri=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F03%2Fpromptedentrypromptedtexts
promptstrings.html&fp=2d2d55f0075054c2dacfbfb290dae2d3&view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&service=gplus&post_uri=http://adndevblog.typepad.com/m
entrypromptedtextspromptstrings.html)andmore...(http://www.typepad.com/sitelogin?
uri=http%3A%2F%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F03%2Fpromptedentrypromptedtexts
promptstrings.html&fp=2d2d55f0075054c2dacfbfb290dae2d3&view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&service=openid&post_uri=http://adndevblog.typepad.com/
entrypromptedtextspromptstrings.html)

(URLsautomaticallylinked.)

Emailaddressisnotdisplayedwithcomment.

Name
EmailAddress
WebSiteURL
Post Preview

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

http://adndevblog.typepad.com/manufacturing/2016/03/promptedentrypromptedtextspromptstrings.html

4/4

You might also like