iLogic AddTitleBlock E_INVALIDARG

iLogic AddTitleBlock E_INVALIDARG

mallorn
Advocate Advocate
794 Views
5 Replies
Message 1 of 6

iLogic AddTitleBlock E_INVALIDARG

mallorn
Advocate
Advocate

Hello,

I'm struggling with re-writing  the same program that I solved already...(lost file), but as I remember last time I had all my PromptedStrings given in array.

here is my iLogic code:

SyntaxEditor Code Snippet

If ThisApplication.ActiveDocument.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
	
	Dim oDoc = ThisApplication.ActiveDocument
	Dim oSheet = oDoc.ActiveSheet
	Dim oProdBlock As TitleBlockDefinition = oDoc.TitleBlockDefinitions.Item("PRODUCTION")
	Dim oTitleBlock As TitleBlock 
	
	If oSheet.TitleBlock Is Nothing Then
		oTitleBlock = oSheet.AddTitleBlock(oProdBlock)
	End If
End If

I have "PRODUCTION" in My Title Blocks, no title block is activated while Rule is started.

I still receive the e "E_INVALIDARG"

 

What do I do wrong?

 

 

-------------------------
Tomasz Malinowski
0 Likes
Accepted solutions (1)
795 Views
5 Replies
Replies (5)
Message 2 of 6

Mark.Lancaster
Consultant
Consultant

@mallorn

 

Inventor programming issues and questions should be asked in the Inventor Customization for best results.  I will have the moderator relocate it there to better suit your needs.

 

https://forums.autodesk.com/t5/inventor-customization/bd-p/120

Mark Lancaster


  &  Autodesk Services MarketPlace Provider


Autodesk Inventor Certified Professional & not an Autodesk Employee


Likes is much appreciated if the information I have shared is helpful to you and/or others


Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.

0 Likes
Message 3 of 6

chandra.shekar.g
Autodesk Support
Autodesk Support

@mallorn,

 

Try below iLogic code. There might be default title block is added on adding new sheet. So, need to delete first.

 

If ThisApplication.ActiveDocument.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
	
	Dim oDoc = ThisApplication.ActiveDocument
	Dim oSheet = oDoc.ActiveSheet
	Dim oProdBlock As TitleBlockDefinition = oDoc.TitleBlockDefinitions.Item("PRODUCTION")
	Dim oTitleBlock As TitleBlock 
        Call	oSheet.TitleBlock.Delete  		
oTitleBlock = oSheet.AddTitleBlock(oProdBlock)
End If

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 4 of 6

mallorn
Advocate
Advocate

Thanks, there is an empty sheet without default block.

I tried with default ISO drawing template with ISO TitleBlock and code works (even when I copy ISO title block to my drawing).

 

There must be something wrong with my title block... which is working if I'll add it manually.

-------------------------
Tomasz Malinowski
0 Likes
Message 5 of 6

mallorn
Advocate
Advocate

@chandra.shekar.g- I have sent you PM with a link to my Drawing file asking to check the Title Blocks.

-------------------------
Tomasz Malinowski
0 Likes
Message 6 of 6

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@mallorn,

 

To add "PRODUCTION" titleblock, Promptstrings are required. Which is third parameter of "Sheet.AddTitileBlock"

 

Sheet.AddTitleBlock( TitleBlockDefinition As Variant, [TitleBlockLocation] As Variant, [PromptStrings] As Variant )

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network