Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Get scale, format for idw Visual Basic

Anonymous

Get scale, format for idw Visual Basic

Anonymous
Not applicable

Hi,

Im trying to find out the parameters that stands for the view scale and format in a idw. I cannot find the parameter for the view scale. Anyone any idea?

 

I use Visual Basic. Code for get mass is easy ...

 

mass = oDoc1.ComponentDefinition.MassProperties.Mass()

 

What about view scale if idw and format?

 

Thanks,

Gregor

0 Likes
Reply
489 Views
5 Replies
Replies (5)

Rob67ert
Collaborator
Collaborator

Hi,

 

I use this:

SyntaxEditor Code Snippet

'ViewScale
Dim odrawdoc As DrawingDocument = ThisDoc.Document
customPropertySet = odrawdoc.PropertySets.Item("Inventor User Defined Properties")
For i = 1 To odrawdoc.Sheets.Count
Try
    prop = customPropertySet.Item("Scale" + Str(i))
Catch
    customPropertySet.Add("", "Scale" + Str(i))
End Try
Try
    iProperties.Value("Custom", "Scale" + Str(i)) = odrawdoc.sheets.item(i).DrawingViews.Item(1).ScaleString
Catch
End Try
Next i
Robert

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

Anonymous
Not applicable

Mr. Robert, thanks for reply, but I had already tried that, and not working.

 

But I found solution,

 

 For Each oDrgView In oDrgViews
                    Dim scl As Double
                    scl = oDrgView.Scale
                    Dim oRefFileDesc As ReferencedFileDescriptor
                    oRefFileDesc = oDrgView.ReferencedFile

                    If (TypeOf oRefFileDesc.ReferencedDocument Is PartDocument) Then
                        Dim oPartDoc As PartDocument
                        oPartDoc = oRefFileDesc.ReferencedDocument
                    ElseIf (TypeOf oRefFileDesc.ReferencedDocument Is AssemblyDocument) Then
                        Dim oAsmDoc As AssemblyDocument
                        oAsmDoc = oRefFileDesc.ReferencedDocument
                    Else
                        Dim oPresDoc As PresentationDocument
                        oPresDoc = oRefFileDesc.ReferencedDocument
                    End If

...

 

that works,

 

Now I don't know how to get FORMAT from idw.

0 Likes

Curtis_Waguespack
Consultant
Consultant

Hi gregor.rihtar,

 

Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I'll ask the forum Admin to move this topic the correct forum.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

0 Likes

MechMachineMan
Advisor
Advisor

What "format" are you talking about/ wanting to get from the drawing?


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

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes

Anonymous
Not applicable

Thanks for reply.

 

I solved that problem too.

 

I will share, maybe someone need it too.

 

merilo = "1 : " + (1 / scl).ToString
sheet_size = oSheet.Size.ToString

 

 

sheet_size ... format (A4, A3 ...)

merilo (1:5 ...)

 

 

0 Likes