New Sheet, Prompted entry window pops up, want to either fill in automaticaly, autopress ok button or esc key

New Sheet, Prompted entry window pops up, want to either fill in automaticaly, autopress ok button or esc key

G.Binl
Advocate Advocate
659 Views
8 Replies
Message 1 of 9

New Sheet, Prompted entry window pops up, want to either fill in automaticaly, autopress ok button or esc key

G.Binl
Advocate
Advocate

I am still fairly new to Ilogic still.

I have a simple rule that creates a new Drawing sheet.

1. It starts a new sheet

2. Adds Title Block

3. Prompts for Entries. ((a pop up window is displayed))

( I believe this is a sketch that lives with in the Title Block but I may be wrong on this.)

at stage 3.

I want to either auto Fill the Entries,  Esc. out of the active window,  Auto click the ok button.

GBinl_1-1648151578857.png

 

Here is the code I am using.

I have been trying many different ways based on things  i have found on the web and come to the belief that i have

no understanding of ilogic. and its structured mysteries.

The reason i want this is its part of a bigger puzzle I'm working that loops creating sheets until its done.

Currently I hold the Esc. key down until its complete. I would like to clean that up.

Many Thanks for viewing This post. 

 

0 Likes
Accepted solutions (1)
660 Views
8 Replies
Replies (8)
Message 2 of 9

blandb
Mentor
Mentor

You didnt have any code attached?

Autodesk Certified Professional
0 Likes
Message 3 of 9

G.Binl
Advocate
Advocate

oops sorry about that got all caught up in the message. 

 

Sub Main

Dim oSheet As Sheet
'oSheet = oDrawDoc.Sheets(1)
'oSheet.Activate

Dim oCommandMgr As CommandManager
oCommandMgr = ThisApplication.CommandManager

' Get New Sheet of IWD
Dim oControlDef As ControlDefinition
MsgBox(1)

oControlDef = oCommandMgr.ControlDefinitions.Item("DrawingNewSheetCtxCmd")
Try
MsgBox(2)

oControlDef.Execute2(True)
MsgBox(3)
Catch


End Try


End Sub

0 Likes
Message 4 of 9

A.Acheson
Mentor
Mentor

Welcome to the drawing automation world: You will need to change the method you add the sheet. Your skipping populating the prompted entry with the straight copy, I personally don't use prompted entry for this reason. 

Here is a post message 14 adds the sheet. You have prompted entry so you will  need to supply information even if blank. Unfortunately there may be no easy way than constructing all the components that make up a drawing sheet. 

 

Api Help Information

Add sheet

Sheetaddtitleblock

 

Here is a vba sample to add titleblockdefintion, if you look down the bottom you will see prompt strings and how to handle them. 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 5 of 9

theo.bot
Collaborator
Collaborator
Accepted solution

@G.Binl 

 

You can combine the methode that @A.Acheson mentioned with a standard ilogic snippet for adding/changing a titleblock with prompted entries. this is a simple one line code, where you can enter all entires as stings. here's a small sample

 

Sub main
	
	Dim oDoc As DrawingDocument
	oDoc = ThisDoc.Document 
	
	'add a blank new sheet, use DrawingSheetSizeEnum for the right size
	Dim oSheet As Sheet
	oSheet = oDoc.Sheets.Add(DrawingSheetSizeEnum.kA3DrawingSheetSize)
	
	'Add title block, enter the promptedentries equal to the number in your title block
	ActiveSheet.SetTitleBlock("Other Title Block", "promptedEntry1", "promptedEntry2")
	
	'Add custom border
	'ActiveSheet.Border = "My Border"
	'Or add default border
	oSheet.AddDefaultBorder(0,,0,,,,False,1,1,1,1)

End Sub

 

Message 6 of 9

G.Binl
Advocate
Advocate

@A.Acheson 

Thanks for the info. i will try this in my code. 

Is there no way to mimic pressing the Esc Key?

what is the the window called that pops up for the prompted entries?

V/r,

-g

0 Likes
Message 7 of 9

G.Binl
Advocate
Advocate

@theo.bot 

Thanks for the information as i said to @A.Acheson i will give it a try.

Thanks 

V/r,

-g

0 Likes
Message 8 of 9

G.Binl
Advocate
Advocate
With some modification I got this to work for my use. Thanks for the help.
0 Likes
Message 9 of 9

G.Binl
Advocate
Advocate
Thanks for the information it help a lot. i ended up using Theo.bot solution with modification knowledge you pointed out.
0 Likes