auto resize idw views when model linked to spreadsheet changes size

auto resize idw views when model linked to spreadsheet changes size

MikeKovacik4928
Advisor Advisor
1,048 Views
7 Replies
Message 1 of 8

auto resize idw views when model linked to spreadsheet changes size

MikeKovacik4928
Advisor
Advisor

I am trying to fit a view to the same size box no matter what
dimensions I give the model.
The dimension I will be changing is on the spreadsheet as
RES01ID and is currently 15355mm
I have scaled VIEW1 to fit onto the sheet at 1:35.
.
If I change the inner diameter of the reservoir to
a smaller figure say 12000mm I want the scale to automatically
change to a smaller value, so the view occupies the same space.
.
I have started an ilogic rule called "Resize view to fit sheet-test01"
I am guessing I can use the system snippets - drawing features
maybe a combination of some of the view snippets like
"View Height" "View Width" "View Scale" "View Set Center"
.
Can anybody guide me in the right direction
.
Michael Kovacik
2d & 3d Autocad and Inventor designer/draughtsman
.
Draughting/Designing (Manufacturing) (31 yrs)
-Drawing Board (3 yrs)
--Cad (28 yrs)
---Cadkey (4 yrs)
---AutoCAD 2d & 3d (16 yrs)
---Inventor (4 yrs)
---Autocad and Inventor Simultaneously (4 years)
---(and recently Autocad/Inventor Customisation)
.
Authorised Autocad & Inventor Professional
Authorised Autodesk Trainer
.
Higher Diploma Mechanical Engineering
Autodesk Product Design Suite Ultimate 2018
Autocad 2018, Inventor Pro 2018
(personal licensed copy)
.
Johannesburg, South Africa
.
(Impossible only means you haven't
found the solution yet)

0 Likes
Accepted solutions (1)
1,049 Views
7 Replies
Replies (7)
Message 2 of 8

MikeKovacik4928
Advisor
Advisor

Okay guys, I get the idea, no spoon feeding, learn for yourself, no body is going to write programs for you.

I couldn't agree more

I will figure this one out  myself

I am loading the self paced guide "My First Plug-in"

and will start learning the VBA language and, in future, post actual attempts and be more specific on my questions

 

Mike Kovacik

0 Likes
Message 3 of 8

dgreatice
Collaborator
Collaborator

Hi,

 

try this:

1. Change model size

2. Open Drawing

3. Run rule

 

Dim oApp As Application
Dim oDoc As Document
Dim oDD As DrawingDocument
Dim oSht As Sheet
Dim oBV As DrawingView
Dim oLabel As DrawingViewLabel
Dim oPt As Point2d
Dim oTg As TransientGeometry

App = ThisApplication
oDoc = oApp.ActiveDocument

 

If oDoc.DocumentType = kDrawingDocumentObject Then
oDD = oDoc
oSht = oDD.ActiveSheet
oBV = oSht.DrawingViews.Item(1)
oLabel = oBV.Label
oPt = oLabel.Position
oTg = oApp.TransientGeometry

oBV.ScaleString = "1 : 1"
BaseWidth = 51.87

If Round(oBV.Width, 2) > BaseWidth Then
SetScale = Round(oBV.Width / BaseWidth, 0)
oBV.ScaleString = "1 : " & SetScale
End If

oLabel.Position = oTg.CreatePoint2d(oBV.Position.X, (oBV.Position.Y - (oBV.Height / 2)))
Else
MsgBox "Only for Drawing Document Type!", vbCritical, "Warning"
End If

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
0 Likes
Message 4 of 8

MikeKovacik4928
Advisor
Advisor

Thanks very much for the programme

I copied and pasted it -see jpeg below

Inventor Customisation Queries_002_Using Ilogic to resize views to fit sheet-009.jpg

However it does not work

It comes up with the following error messages

See jpegs inserted below

Inventor Customisation Queries_002_Using Ilogic to resize views to fit sheet-012.jpgInventor Customisation Queries_002_Using Ilogic to resize views to fit sheet-013.jpgNot too sure how to fix it, what those messages refers to.

I am running Inventor Pro 2018 by the way.

 

Mike

0 Likes
Message 5 of 8

MikeKovacik4928
Advisor
Advisor

In answer to autodesk's email

See jpeg below

This has not yet been solved

A illogic programme was kindly posted, but it did not work.

I have posted screenshots of what I did and the error messages I received.

Inventor Customisation Queries_002_Using Ilogic to resize views to fit sheet-014.jpglMike Kovacik

0 Likes
Message 6 of 8

dgreatice
Collaborator
Collaborator
Accepted solution

Hi,

 

Sorry for late respond.

 

 

Dim oApp As Application
Dim oDoc As Document
Dim oDD As DrawingDocument
Dim oSht As Sheet
Dim oBV As DrawingView
Dim oLabel As DrawingViewLabel
Dim oPt As Point2d
Dim oTg As TransientGeometry
oApp = ThisApplication
oDoc = oApp.ActiveDocument
 
If oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
oDD = oDoc
oSht = oDD.ActiveSheet
oBV = oSht.DrawingViews.Item(1)
oLabel = oBV.Label
oPt = oLabel.Position
oTg = oApp.TransientGeometry
oBV.ScaleString = "1 : 1"
BaseWidth = 51.87
If Round(oBV.Width, 2) > BaseWidth Then
SetScale = Round(oBV.Width / BaseWidth, 0)
oBV.ScaleString = "1 : " & SetScale
End If
oLabel.Position = oTg.CreatePoint2d(oBV.Position.X, (oBV.Position.Y - (oBV.Height / 2)))
Else
MsgBox ("Only for Drawing Document Type!", vbCritical, "Warning")
End If

 

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
0 Likes
Message 7 of 8

MikeKovacik4928
Advisor
Advisor

Thanks!

Works perfectly

Will use your program as a starting point to learn

Programming. Will be in touch over in future over the forum

with more specific questions about how your program works

 

Mike

0 Likes
Message 8 of 8

dgreatice
Collaborator
Collaborator

Great,

 

You can learn more in:

 

http://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-6FD7AA08-1E43-43FC-971B-5F20E56C8846

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
0 Likes