Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

setting a view scale

8 REPLIES 8
Reply
Message 1 of 9
billco-mfg
452 Views, 8 Replies

setting a view scale

I can read a view scale with:
BaseViewScale = oDoc.Sheets.Item(1).DrawingViews.Item(1).Scale

But When I try to use the following line to change the scale, I get a compile error.
oDoc.Sheets.Item(1).DrawingViews.Item(1).Scale = BaseViewScale

What type of variable should BaseViewScale be (single, double, string)?
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: billco-mfg

'Scale' happens to be a reserved keyword in VB and hence needs to be qualified by [] for DrawingView.Scale to work. So, this should work: oDoc.Sheets.Item(1).DrawingViews.Item(1).[Scale] = BaseViewScale Sanjay- "wehnerk" wrote in message news:19259224.1108874268380.JavaMail.jive@jiveforum1.autodesk.com... > I can read a view scale with: > BaseViewScale = oDoc.Sheets.Item(1).DrawingViews.Item(1).Scale > > But When I try to use the following line to change the scale, I get a compile error. > oDoc.Sheets.Item(1).DrawingViews.Item(1).Scale = BaseViewScale > > What type of variable should BaseViewScale be (single, double, string)?
Message 3 of 9
billco-mfg
in reply to: billco-mfg

I thought the easy fix would work, but it was too good to be true.
Message 4 of 9
Anonymous
in reply to: billco-mfg

So, that didn't work? I tried it and it seemed to work. Also, the ability to set the property was only introduced in R9. What version do you have? "wehnerk" wrote in message news:25518344.1108953416012.JavaMail.jive@jiveforum2.autodesk.com... > I thought the easy fix would work, but it was too good to be true.
Message 5 of 9
Anonymous
in reply to: billco-mfg

R9 Sp2 "Sanjay Ramaswamy (Autodesk)" wrote in message news:42196e38_3@newsprd01... > So, that didn't work? I tried it and it seemed to work. Also, the ability > to > set the property was only introduced in R9. What version do you have? > > > "wehnerk" wrote in message > news:25518344.1108953416012.JavaMail.jive@jiveforum2.autodesk.com... >> I thought the easy fix would work, but it was too good to be true. > >
Message 6 of 9
Anonymous
in reply to: billco-mfg

Not sure what the problem is. Try to run the following code on a new drawing that contains a drawing view. Sub ChangeScale() Dim odoc As DrawingDocument Set odoc = ThisApplication.ActiveDocument Dim odrawingview As DrawingView Set odrawingview = odoc.ActiveSheet.DrawingViews(1) odrawingview.[Scale] = 2 End Sub Sanjay- "Kevin Wehner (IV9 SP2)" wrote in message news:4219c4a1$1_2@newsprd01... > R9 Sp2 > > "Sanjay Ramaswamy (Autodesk)" wrote in > message news:42196e38_3@newsprd01... > > So, that didn't work? I tried it and it seemed to work. Also, the ability > > to > > set the property was only introduced in R9. What version do you have? > > > > > > "wehnerk" wrote in message > > news:25518344.1108953416012.JavaMail.jive@jiveforum2.autodesk.com... > >> I thought the easy fix would work, but it was too good to be true. > > > > > >
Message 7 of 9
Anonymous
in reply to: billco-mfg

That works. Isn't the line that I had basically the same thing? Maybe I don't have a full understanding of lines like "Dim odrawingview As DrawingView" & "Set odrawingview = odoc.ActiveSheet.DrawingViews(1)". Aren't they used in this case just to make "odrawingview.[Scale] = 2" shorter than ThisApplication.ActiveDocument.ActiveSheet.DrawingViews(1).[Scale] = 2" ? "Sanjay Ramaswamy (Autodesk)" wrote in message news:421a8c1a$1_3@newsprd01... > Not sure what the problem is. Try to run the following code on a new > drawing > that contains a drawing view. > > Sub ChangeScale() > Dim odoc As DrawingDocument > Set odoc = ThisApplication.ActiveDocument > > Dim odrawingview As DrawingView > Set odrawingview = odoc.ActiveSheet.DrawingViews(1) > > odrawingview.[Scale] = 2 > End Sub > > Sanjay- > > > "Kevin Wehner (IV9 SP2)" wrote in > message news:4219c4a1$1_2@newsprd01... >> R9 Sp2 >> >> "Sanjay Ramaswamy (Autodesk)" wrote in >> message news:42196e38_3@newsprd01... >> > So, that didn't work? I tried it and it seemed to work. Also, the > ability >> > to >> > set the property was only introduced in R9. What version do you have? >> > >> > >> > "wehnerk" wrote in message >> > news:25518344.1108953416012.JavaMail.jive@jiveforum2.autodesk.com... >> >> I thought the easy fix would work, but it was too good to be true. >> > >> > >> >> > >
Message 8 of 9
Anonymous
in reply to: billco-mfg

Not sure why that doesn't work. Seems like a VB quirk. If you try to set the Name property using the same line of code, that works fine. It has something to do with the reserved keywords. Sanjay- "Kevin Wehner (IV9 SP2)" wrote in message news:421b2f23_3@newsprd01... > That works. Isn't the line that I had basically the same thing? Maybe I > don't have a full understanding of lines like "Dim odrawingview As > DrawingView" & "Set odrawingview = odoc.ActiveSheet.DrawingViews(1)". Aren't > they used in this case just to make "odrawingview.[Scale] = 2" shorter than > ThisApplication.ActiveDocument.ActiveSheet.DrawingViews(1).[Scale] = 2" ? > > > "Sanjay Ramaswamy (Autodesk)" wrote in > message news:421a8c1a$1_3@newsprd01... > > Not sure what the problem is. Try to run the following code on a new > > drawing > > that contains a drawing view. > > > > Sub ChangeScale() > > Dim odoc As DrawingDocument > > Set odoc = ThisApplication.ActiveDocument > > > > Dim odrawingview As DrawingView > > Set odrawingview = odoc.ActiveSheet.DrawingViews(1) > > > > odrawingview.[Scale] = 2 > > End Sub > > > > Sanjay- > > > > > > "Kevin Wehner (IV9 SP2)" wrote in > > message news:4219c4a1$1_2@newsprd01... > >> R9 Sp2 > >> > >> "Sanjay Ramaswamy (Autodesk)" wrote in > >> message news:42196e38_3@newsprd01... > >> > So, that didn't work? I tried it and it seemed to work. Also, the > > ability > >> > to > >> > set the property was only introduced in R9. What version do you have? > >> > > >> > > >> > "wehnerk" wrote in message > >> > news:25518344.1108953416012.JavaMail.jive@jiveforum2.autodesk.com... > >> >> I thought the easy fix would work, but it was too good to be true. > >> > > >> > > >> > >> > > > > > >
Message 9 of 9
ADNpati
in reply to: Anonymous

Sanjay!!!!! my Man....... good point to remember abt Scale..

 

Worked WELL!!!!

 

Amool.

Mechanical Engineer
Inventor Applications Engineer

--------------------------------------------------------------------------------------

If my solution seems to remedy your problem, please press the Accept Solution button, Some KUDOS -

-------------------------------------------------------------------------------------

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report