Place drawing view in drawing sheet using Ilogic or VBA!

Place drawing view in drawing sheet using Ilogic or VBA!

vinayababu.yerneni
Enthusiast Enthusiast
1,061 Views
1 Reply
Message 1 of 2

Place drawing view in drawing sheet using Ilogic or VBA!

vinayababu.yerneni
Enthusiast
Enthusiast

Hi, please accept the challenge for my question. I need to place a drawing view on a active drawing sheet using Ilogic. 

1. Run the rule 

2. select the view for the drawing to be placed from my opened part document (part document is now activated).

3. Go to the drawing sheet (Drawing document is now activated for placing the drawing)

4. Instead of co-ordinates, I want interface and mouse to move my drawing on the sheet so that i could place the views where ever I want.

5. Another part document will be opened.

6. The steps 2,3 &4 will be repeated.

 

I have written the some part of the code for my part document open and drawing document. please share your knowledge on this!!!

 

 

Dim oPartDoc As PartDocument


Dim FSO As Scripting.FileSystemObject 'call the filesystemobject or Tools < Refernces < MS scripting
Set FSO = New Scripting.FileSystemObject

Dim FolderRef As Scripting.Folder

Dim FileRef As Scripting.File
Job = InputBox("Enter the Job: ", "Job Tiltle", "8856 or 9354")


folderpath = "\\inventor\Inventor\Projects\R" & Job & "\FLAT COVER"
Set FolderRef = FSO.GetFolder(folderpath)


Set oDoc = ThisDocument
Dim oPoint4 As Point2d
Dim Count As Integer
Count = 0
For Each FileRef In FolderRef.Files

If Left(FileRef.Name, 7) = "COVER B" Or Left(FileRef.Name, 6) = "CT ROD" Then
Count = Count + 1

End If
Next
MsgBox ("The Extra part count is" = Count)

For Each FileRef In FolderRef.Files

If Left(FileRef.Name, 7) = "COVER B" Or Left(FileRef.Name, 6) = "CT ROD" Then


Set oPartDoc = ThisApplication.Documents.Open(folderpath & "\" & FileRef.Name)

Dim oObject As Object
Set oObject = ThisApplication.CommandManager.Pick(kPartFeatureFilter, "Pick a Face or Edge to continue")

Call oPartDoc.Close
Dim oBorder As Border
Set oBorder = oSheet.Border

oDoc.Activate

Dim x, y, j As Integer
j = 1
'Select Case Left(FileRef.Name, 7)

'Case "COVER B"

Set oPoint4 = ThisApplication.TransientGeometry.CreatePoint2d(oBorder.RangeBox.MinPoint.x + 8, oBorder.RangeBox.MinPoint.y + 😎
Dim oView4 As DrawingView


Set oView4 = oSheet.DrawingViews.AddBaseView(oPartDoc, _
oPoint4, 0.07, kCurrentViewOrientation, kHiddenLineRemovedDrawingViewStyle)


'Dim oSheet As Sheet
Set oSheet = oDoc.Sheets.Item(1)
ThisApplication.ActiveView.Fit
End If
Next

0 Likes
1,062 Views
1 Reply
Reply (1)
Message 2 of 2

A.Acheson
Mentor
Mentor

Here is an ilogic rule to achieve some of your requests. The paths are hardcoded so you will need to add to the rule depending on where you want the user to start and how the workflow will proceed. The rule uses the command buttons similar to how you manually place the views. 

https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/ilogic-isn-t-waiting-for-drawingbase...

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