how to make an .iam assembly become .dgw from ilogic

how to make an .iam assembly become .dgw from ilogic

anavazquez5LRNJ
Enthusiast Enthusiast
238 Views
3 Replies
Message 1 of 4

how to make an .iam assembly become .dgw from ilogic

anavazquez5LRNJ
Enthusiast
Enthusiast

I don't know if someone already tried to automate the .dgw drawings from ilogic.
I would like that since I open an .iam I can do it from some rule.

0 Likes
239 Views
3 Replies
Replies (3)
Message 2 of 4

A.Acheson
Mentor
Mentor

Hi @anavazquez5LRNJ 

Do you mean Inventor .Dwg extension type drawing? What specifically about the drawing do you want to automate? Simply to open the drawing allready complete saved on disk or to create a drawing  from scratch placing views etc. There are many forum posts which have carried out some degree of automation. Do you have a sample you have tried or can provide as a bases to start the conversation? 

 

Here is a start point from the API samples written in VBA. Remove the word Set and change the word "AddBaseViewWithRepresentations()"to "Main"

This will create a view with the given assembly filepath.

 

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

anavazquez5LRNJ
Enthusiast
Enthusiast

hi  @A.Acheson @JelteDeJong 

up to this point I have already sent the views to the drawing now I want to put the dimensions JelteDeJong

Here is the code I'm working with

Dim oDrawingDoc As DrawingDocument   
Dim oPartDoc As Document 
Dim oSheet As Sheet 
 oView1 As DrawingView 
Dim oView2 As DrawingView
Dim oView3 As DrawingView
Dim oView4 As DrawingView
Dim oView5 As DrawingView
Dim oView6 As DrawingView
Dim DrawingName As String = "TestPart001-Copia " 
Dim OutputFolder As String = "C:\temp\Archivos\"
']

    oPartDoc = ThisDoc.Document
    oDrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "C:\Inventor\Proyectos\Door.dwg", True) 
    oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(11, 16) '
	oPoint3 = ThisApplication.TransientGeometry.CreatePoint2d(8, 16)
	oPoint4 = ThisApplication.TransientGeometry.CreatePoint2d(14, 16)
	oPoint5 = ThisApplication.TransientGeometry.CreatePoint2d(11, 21)
	oPoint6 = ThisApplication.TransientGeometry.CreatePoint2d(11, 8)
	

	
	
	oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc, oPoint1, 1/32, kFrontViewOrientation, kHiddenLineDrawingViewStyle, KTANGENTEDGESON) 
oView3 = oSheet.DrawingViews.AddBaseView(oPartDoc, oPoint3, 1 / 32, kLeftViewOrientation, kHiddenLineDrawingViewStyle, KTANGENTEDGESON)
oView4 = oSheet.DrawingViews.AddBaseView(oPartDoc, oPoint4, 1 / 32,  kRightViewOrientation, kHiddenLineDrawingViewStyle, KTANGENTEDGESON)
oView5 = oSheet.DrawingViews.AddBaseView(oPartDoc, oPoint5, 1 / 32,  kTopViewOrientation, kHiddenLineDrawingViewStyle, KTANGENTEDGESON)
oView6 = oSheet.DrawingViews.AddBaseView(oPartDoc, oPoint6, 1 / 32,  kBottomViewOrientation, kHiddenLineDrawingViewStyle, KTANGENTEDGESON)



oDrawingDoc.SaveAsInventorDWG(OutputFolder & DrawingName & ".dwg", SaveCopyAs)'Guarda el dibujo generado
oPartDoc.Activate 
oDrawingDoc.Update 'Actualiza el Dibujo
oDrawingDoc.Activate 'Activa el Documento
oDrawingDoc.Save 'Guarda el Documento del Dibujo
'oDrawingDoc.Close
ThisDoc.Launch(OutputFolder) 

 

 

 

 

0 Likes
Message 4 of 4

A.Acheson
Mentor
Mentor

That is a good starting point and really there isn't a lot to add other than you might want to launch the rule from the assembly rather than feeding in the path of the assembly. So if you want to modify this section please let us know. 

 

The dimensions and annotation is a complete another matter and this complexity will likely need a huge investment of time and knowledge to have a satisfactory outcome. Certainty not for a beginner in iLogic, I don't personally go this far in automation due to the complexity and I don't think many do but if you want to get yourself a pot a coffee and give it a go. Here is a post that shows how to add balloons and an article from JelteDeJong on how to automate some dimensions. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes