Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get scale, format for idw Visual Basic

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
455 Views, 5 Replies

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

Get scale, format for idw Visual Basic

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

5 REPLIES 5
Message 2 of 6
Rob67ert
in reply to: Anonymous

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

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.
Message 3 of 6
Anonymous
in reply to: Rob67ert

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

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.

Message 4 of 6
Curtis_Waguespack
in reply to: Anonymous

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

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

 

Message 5 of 6
MechMachineMan
in reply to: Anonymous

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

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
Message 6 of 6
Anonymous
in reply to: MechMachineMan

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

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 ...)

 

 

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

Post to forums  

Autodesk Design & Make Report