Submitted by Mohammed Shadab on Tue, 02/18/2020 - 16:49
Forums:
I want to generate auto balloon in 2D Drawing . How to start the code ? Please help me . If there is any code which is already available if yes please share with me.
I want to generate auto balloon in 2D Drawing . How to start the code ? Please help me . If there is any code which is already available if yes please share with me.
re: autoballoon
Once you have a parts list, you can use the PList.AddObject method to autoballoon a drafting view.
theUfSession.Plist.AddObject(Plist.Tag, FALSE, DraftingView.Tag)
Auto Balloon
I want to generate Auto Balloon Without Part List. Can you help me with that Please?
re: autoballoon
To the best of my knowledge, autoballoons require a parts list to be present. I know of no way to use the autoballoon function without a parts list.
Auto Balloon
I want to generate Auto Balloon to the Dimensions which i'll give in Drafting view. Then those ballooned dimensions i want to export it to excel.
Thank you.
re: balloon dimensions
The journal at the link below will assign ID symbols (balloons) to the selected dimensions. It probably doesn't do exactly what you want, but it may be a good starting point.
http://nxjournaling.com/content/creating-qc-inspection-numbers-using-nx-...
Also, there is a simplistic journal here that will export dimensions to Excel.
http://nxjournaling.com/comment/623#comment-623
Attributes
Some how I manage to generate auto balloon to the dimensions. which ever I give the dimensions first that dimension is assigned as number 1 and so on.
But I want to generate auto balloons in a sequence. So that a series of number should be in one place.
I want to generate balloons according to the views which I give. For example first I want to generate balloon in front view, then side view, then bottom view.
Is there are any attributes that help me doing this. If yes then please share with me.
Thank you.
re: dimensions and views
The code below will allow you to select a dimension and will report the view the drafting dimension is associated with (not tested with PMI dimensions). Using this technique, you could iterate over all the dimensions and sort them by drafting view and add your callouts per view.
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module Module1
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim theUI As UI = UI.GetUI()
Dim lw As ListingWindow = theSession.ListingWindow
Sub Main()
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "NXJ")
lw.Open()
Dim myDim1 As Annotations.Dimension
If SelectDimension("Select first dimension", myDim1) = Selection.Response.Cancel Then
Return
End If
Dim myDimAssociativity As Annotations.Associativity
For i As Integer = 1 To myDim1.NumberOfAssociativities
lw.WriteLine("associativity: " & i.ToString)
myDimAssociativity = myDim1.GetAssociativity(i)
Dim myView As View = myDimAssociativity.ObjectView
lw.WriteLine("associated view: " & myView.Name)
Next
lw.Close()
End Sub
Function SelectDimension(ByVal prompt As String, ByRef selObj As TaggedObject) As Selection.Response
Dim theUI As UI = UI.GetUI
Dim title As String = "Select a dimension"
Dim includeFeatures As Boolean = False
Dim keepHighlighted As Boolean = False
Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific
Dim cursor As Point3d
Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart
Dim selectionMask_array(0) As Selection.MaskTriple
With selectionMask_array(0)
.Type = UFConstants.UF_dimension_type
.Subtype = UFConstants.UF_dim_horizontal_subtype
End With
Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObject(prompt,
title, scope, selAction,
includeFeatures, keepHighlighted, selectionMask_array,
selObj, cursor)
If resp = Selection.Response.ObjectSelected OrElse resp = Selection.Response.ObjectSelectedByName Then
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If
End Function
Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
'----Other unload options-------
'Unloads the image when the NX session terminates
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
'Unloads the image explicitly, via an unload dialog
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
'-------------------------------
End Function
End Module