insert block into drawing sheet with custom part property
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a custom property that I can change from a list on a part form.
This variable must be recognized at the time of inserting the part into the drawing sheet, depending on this variable, which can be N7, N5, N4, N3, etc. A predefined block that already exists in the resources folder of the drawing module will be inserted.
The custom property has the same names as the blocks in the resources folder, so when you select the property in the part, in the drawing format it will recognize the block and insert it in a coordinate dependent on the size of the sheet.
"
InventorVb.DocumentUpdate() Dim BLOQUE As String = iProperties.Value("Custom", "RUGOSIDAD") Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument Dim oSheet As Sheet oSheet = oDrawDoc.ActiveSheet Dim oSketchedSymbolDef As SketchedSymbolDefinition oSketchedSymbolDef = oDrawDoc.SketchedSymbolDefinitions.Item("RUGOSIDAD") Dim oTG As TransientGeometry oTG = ThisApplication.TransientGeometry Select Case BLOQUE Case "FORMATO A4" Dim oSketchedSymbol As SketchedSymbol oSketchedSymbol = oSheet.SketchedSymbols.Add _ (oSketchedSymbolDef, oTG.CreatePoint2d(11.3, 6.2), 0, 1, sPromptStrings) Case "FORMATO A3" Dim oSketchedSymbol As SketchedSymbol oSketchedSymbol = oSheet.SketchedSymbols.Add _ (oSketchedSymbolDef, oTG.CreatePoint2d(15.5, 6.2), 0, 1, sPromptStrings) Case "FORMATO A2" Dim oSketchedSymbol As SketchedSymbol oSketchedSymbol = oSheet.SketchedSymbols.Add _ (oSketchedSymbolDef, oTG.CreatePoint2d(17.5, 6.2), 0, 1, sPromptStrings) Case "FORMATO A1" Dim oSketchedSymbol As SketchedSymbol oSketchedSymbol = oSheet.SketchedSymbols.Add _ (oSketchedSymbolDef, oTG.CreatePoint2d(20.5, 6.2), 0, 1, sPromptStrings) Case "FORMATO A0" Dim oSketchedSymbol As SketchedSymbol oSketchedSymbol = oSheet.SketchedSymbols.Add _ (oSketchedSymbolDef, oTG.CreatePoint2d(23.5, 6.2), 0, 1, sPromptStrings) Case Else End Select oSheet.Update()
I generated this code, but I still can't get it to work
I don't know if what I want to achieve is possible, I can make a block be inserted automatically into the drawing, but I can't make the block selection exercise more dynamic.
can you help me, please