How to tackle this Idea?

How to tackle this Idea?

machiel.veldkamp
Collaborator Collaborator
639 Views
9 Replies
Message 1 of 10

How to tackle this Idea?

machiel.veldkamp
Collaborator
Collaborator

I've had this Idea for a while and I can't wait for Autodesk to implement it. 

 

http://forums.autodesk.com/t5/inventor-ideas/drawing-environment-place-folded-model-view-from-flat-p...

 

Any tips on how to tackle this? 

I've had experience with iLogic but not so much in the drawing environement. 

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes
Accepted solutions (1)
640 Views
9 Replies
Replies (9)
Message 2 of 10

Rob67ert
Collaborator
Collaborator

Hi Machiel,

 

I don't understand the problem.

If it is that you have to place the view twice, why not just copy it?

Robert

If you find this reply helpful ? It would be nice if you use the Accept as Solution or Kudos button below.
0 Likes
Message 3 of 10

machiel.veldkamp
Collaborator
Collaborator

Well... it's a lot of work! 
For one or two models per day it's fine but I do this multiple times per hour. 

 

 

 

If you copy a base view with the Flat Pattern selected, you can't select the Folded Model anymore. 

 

So what I'd want is a rule that 'sees' what view I'm clicking and places a new base view 90deg off of the base view I've selected. 

 

 

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes
Message 4 of 10

machiel.veldkamp
Collaborator
Collaborator

I've made a screengrab of the process.

I want to automate this. 

 

https://knowledge.autodesk.com/community/screencast/eb916301-0b7e-4abc-a43d-b8df276aef01

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes
Message 5 of 10

Owner2229
Advisor
Advisor

Well, there are two ways to do this:

1) Create a template drawings with two views (flat pattern and side view).

Create a makro button in sheet metal part interface on one of the ribbon tabs.

Use this button to open the template, replace the part reference to the currently open part and save it under new name (auto/man).

This one has an advantage: You can have some dimensions already in place and they will be (mostly) preserved as you create new drawings.

 

2) Create a makro/rule in drawing that every time you place a flatted view it will place a side view right next to it.

 

I already have the code for 1), so I'll just have to slightly modify it.

The second option would have to be made from scratch.

 

I can look on it later if I'll have some time, so let me know which you prefer.

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
Message 6 of 10

machiel.veldkamp
Collaborator
Collaborator

The second option is the thing I've had in mind. 

 

If you have any code that can help me get started, that would be great.

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes
Message 7 of 10

Owner2229
Advisor
Advisor

Alright, the code will be something like this below.

Notice I don't remember which values starts counting with 1 and which with 0, so you have to test it.

You might also need to play with some of the values, especialy with the Orientation.

I can write there a condition that will literary turn the view to one side of the original view, but it's extra coding, so I'll do it only if necessary.

Let me know if there're any errors and I'll look on it.

 

Dim oDoc As Document = ThisApplication.ActiveDocument
If oDoc.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub
Dim oSheet As Sheet = oDoc.Sheets.Item(0)
If oSheet.DrawingViews.Count = 0 Then Exit Sub Dim oView As DrawingView = oSheet.DrawingViews.Item(0) Dim oModel As Document = oDoc.ReferencedDocuments.Item(1)
If oModel.DocumentSubTypeID <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Exit Sub
Dim oPosition As Point2d = oView.Position Dim oSpace As Double = oView.Width oPosition.X = oPosition.X + oSpace Dim oScale As Double = oView.Scale Dim oOrientation As ViewOrientationTypeEnum = ViewOrientationTypeEnum.kRightViewOrientation Dim oViewStyle As DrawingViewStyleEnum = oView.ViewStyle oSheet.DrawingViews.AddBaseView(oModel, oPosition, oScale, oOrientation, oViewStyle)

 

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes
Message 8 of 10

machiel.veldkamp
Collaborator
Collaborator

Hey @Owner2229

Thanks for the reply! Sorry for the late reaction. 

 

 

Thanks for the code as well! This will get me started, I'm sure. 

 

It gives me the standard 'doesn't work' error. You know the one. 

 

 

I can't quite figure out how the rule selects the view to be done. 
Do you know if there's a selecter thing in iLogic? 

 

like a WaitForButtonPress only then for views?

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes
Message 9 of 10

Owner2229
Advisor
Advisor
Accepted solution

Hey, it's selecting the Xth paced view from all views.

Anyway, here's the code (now tested) with some descriptions:

 

'Get the active document
Dim oDoc As Document = ThisApplication.ActiveDocument
'Exit if the document isn't drawing
If oDoc.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub
'Get the first sheet
Dim oSheet As Sheet = oDoc.Sheets.Item(1)
'Exit if the sheet have no views
If oSheet.DrawingViews.Count = 0 Then Exit Sub
'Get the first view
Dim oView As DrawingView = oSheet.DrawingViews.Item(1)
'Get the first document from the view
Dim oModel As Document = oDoc.ReferencedDocuments.Item(1)
'Exit if the referenced document isn't sheet metal
If oModel.DocumentSubType.DocumentSubTypeID <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Exit Sub
'Get the view position
Dim oPosition As Point2d = oView.Position
'Get the view size
Dim oSpace As Double = oView.Width
'Offset the position
oPosition.X = oPosition.X + oSpace
'Get the view scale
Dim oScale As Double = oView.Scale
'Set the orientation
Dim oOrientation As ViewOrientationTypeEnum = ViewOrientationTypeEnum.kRightViewOrientation
'Set the view style
Dim oViewStyle As DrawingViewStyleEnum = oView.ViewStyle
'Add the new view
oSheet.DrawingViews.AddBaseView(oModel, oPosition, oScale, oOrientation, oViewStyle)

But if you want to select the view manually instead, use this:

 

'Get the active document
Dim oDoc As Document = ThisApplication.ActiveDocument
'Exit if the document isn't drawing
If oDoc.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub
'Get the first sheet
Dim oSheet As Sheet = oDoc.Sheets.Item(1)
'Exit if the sheet have no views
If oSheet.DrawingViews.Count = 0 Then Exit Sub
'Get the selection from user
Dim oSelect As Object = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Pick a view")
'Exit if nothing is selected
If oSelect Is Nothing Then Exit Sub 'Get the view Dim oView As DrawingView = oSelect 'Get the first document from the view Dim oModel As Document = oDoc.ReferencedDocuments.Item(1) 'Exit if the referenced document isn't sheet metal If oModel.DocumentSubType.DocumentSubTypeID <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Exit Sub 'Get the view position Dim oPosition As Point2d = oView.Position 'Get the view size Dim oSpace As Double = oView.Width 'Offset the position oPosition.X = oPosition.X + oSpace 'Get the view scale Dim oScale As Double = oView.Scale 'Set the orientation Dim oOrientation As ViewOrientationTypeEnum = ViewOrientationTypeEnum.kRightViewOrientation 'Set the view style Dim oViewStyle As DrawingViewStyleEnum = oView.ViewStyle 'Add the new view oSheet.DrawingViews.AddBaseView(oModel, oPosition, oScale, oOrientation, oViewStyle)
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes
Message 10 of 10

machiel.veldkamp
Collaborator
Collaborator

Thanks! I can definitely do something with this! Greatly apreciated. 

 

I'll update this post when I've updated the rule as how I will use it. 

 

 

 

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes