Hi all,
i like to have a code that insert sketched symbols in the right corner of my sheet. The Goal is, i have more than one different Sheets (A4, A3...) in my IDW.
How can i get the different sheet-formats (A4, A3....), so that i can calculate the right lower corner to get the insert point.
For Each oSheet In oIDW.Sheets Dim Format As String Format = ActiveSheet.Size MessageBox.Show(Format, "Title") Next
The above code only gets the format from the first side...
Who can help me?
Regards an a nice Weekend ...
Martin
Solved! Go to Solution.
Solved by martinhoos. Go to Solution.
On Error Resume Next
Select Case oDrgDoc.ActiveSheet.Size
Case kA4DrawingSheetSize
Case kA3DrawingSheetSize
Case kA2DrawingSheetSize
Case kA1DrawingSheetSize
Case kA0DrawingSheetSize
Case Else ' Andere Werte.
End Select
Thank you for your reply. I dont know where i have to put your code in. Pls can you change my code with yours?
Thank you very much.
Regards Martin
Dim oIDW As DrawingDocument oIDW = ThisApplication.ActiveDocument Dim oSheet As Sheet oSheet = oIDW.ActiveSheet Dim oLayers As LayersEnumerator = oSheet.Parent.StylesManager.Layers Dim sFormatName As String For Each oSheet In oIDW.Sheets If ActiveSheet.Size = "A4" Then sFormatName = "A4" MessageBox.Show(sFormatName , "iLogic") ElseIf ActiveSheet.Size = "A3" Then sFormatName = "A3" MessageBox.Show(sFormatName , "iLogic") End If Next
Hi @martinhoos,
Basically, Sheet.Size property returns DrawingSheetSizeEnum Enumerator not a string value.Try the following changes in your code.
Dim oIDW As DrawingDocument oIDW = ThisApplication.ActiveDocument Dim oSheet As Sheet oSheet = oIDW.ActiveSheet Dim oLayers As LayersEnumerator = oSheet.Parent.StylesManager.Layers Dim sFormatName As String For Each oSheet In oIDW.Sheets If oSheet.Size = kA4DrawingSheetSize Then sFormatName = "A4" MessageBox.Show(sFormatName , "iLogic") ElseIf oSheet.Size = kA3DrawingSheetSize Then sFormatName = "A3" MessageBox.Show(sFormatName , "iLogic")
ElseIf oSheet.Size = kA2DrawingSheetSize Then
sFormatName = "A2"
MessageBox.Show(sFormatName , "iLogic")
ElseIf oSheet.Size = kA1DrawingSheetSize Then
sFormatName = "A1"
MessageBox.Show(sFormatName , "iLogic")
ElseIf oSheet.Size = kA0DrawingSheetSize Then
sFormatName = "A0"
MessageBox.Show(sFormatName , "iLogic") End If Next
Refer the following link for more details about DrawingSheetSizeEnum Enumerator
http://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-55595BC5-77E1-485D-861D-B1FE827EE132
Please feel free to contact if there is any queries.
If problem solved, click on "Accept as solution" / give a "Kudo".
Thanks and regards,
Hi chandra.shekar.g,
thank you for your reply. I tried your code, but i get no result. May be, because we are using Inventor 2015?
If i copy this line:
MessageBox.Show(sFormatName , "iLogic")
to the end of your code - the window is emty.
Regards
Martin
Hello chandra.shekar.g,
I placed DrawingSheetSizeEnum in front of kA4DrawingSheetSize and it runs.....
Thanks again for your support
Regards Martin
Dim oIDW As DrawingDocument oIDW = ThisApplication.ActiveDocument Dim oSheet As Sheet oSheet = oIDW.ActiveSheet Dim oLayers As LayersEnumerator = oSheet.Parent.StylesManager.Layers Dim sFormatName As String For Each oSheet In oIDW.Sheets If oSheet.Size = DrawingSheetSizeEnum.kA4DrawingSheetSize Then sFormatName = "A4" MessageBox.Show(sFormatName , "iLogic") ElseIf oSheet.Size = DrawingSheetSizeEnum.kA3DrawingSheetSize Then sFormatName = "A3" MessageBox.Show(sFormatName , "iLogic") ElseIf oSheet.Size = DrawingSheetSizeEnum.kA2DrawingSheetSize Then sFormatName = "A2" MessageBox.Show(sFormatName , "iLogic") ElseIf oSheet.Size = DrawingSheetSizeEnum.kA1DrawingSheetSize Then sFormatName = "A1" MessageBox.Show(sFormatName , "iLogic") ElseIf oSheet.Size = DrawingSheetSizeEnum.kA0DrawingSheetSize Then sFormatName = "A0" MessageBox.Show(sFormatName , "iLogic") End If Next
Can't find what you're looking for? Ask the community or share your knowledge.