As engineers and designers, we often have to work with complex 3D models and drawings, and extracting important information from these can be a time-consuming and challenging task. One of the critical pieces of information we may need to extract from a drawing sheet is the dimensions of the holes present in the model. This information can be essential for manufacturing, assembly, and quality control purposes.
In this blog article, we will explore how to extract meaningful information from a drawing sheet using CycleObjsInPart and nx open, specifically focusing on finding and displaying hole dimension values.
What is CycleObjsInPart?
CycleObjsInPart is a part of UFUNC Objects namespace provided by the NX Open API that allows you to iterate through all objects in a given part. It can be used to extract information about the features, dimensions, and attributes of the objects in the part.
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities
Imports NXOpen.Annotations
Module report_holedimension_of_drawing_sheet
Dim theSession As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim IgnoreEcho As Boolean = False 'Set to True to suppress messages
Sub Main(ByVal args() As String)
'Insert code here
Dim dp As Part = theSession.Parts.Display
Dim dimvalue As NXOpen.Tag = NXOpen.Tag.Null
Dim dimObj As Annotation = Nothing
Do
ufs.Obj.CycleObjsInPart(dp.Tag, UFConstants.UF_dimension_type, dimvalue)
Try
Dim obj As Dimension = NXOpen.Utilities.NXObjectManager.Get(dimvalue)
'obj = NXObjectManager.Get(draftnote)
Dim maintext(0), dualtext(0) As String
obj.GetDimensionText(maintext, dualtext)
If obj.GetType().Name = "HoleDimension" Then
Echo(maintext(0))
End If
'Echo(dualtext(0))
Catch ex As Exception
End Try
Loop Until dimvalue = NXOpen.Tag.Null
End Sub
Sub Echo(ByVal output As String)
If IgnoreEcho = True Then
Return
End If
theSession.ListingWindow.Open()
theSession.ListingWindow.WriteLine(output)
theSession.LogFile.WriteLine(output)
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
Return Session.LibraryUnloadOption.Immediately
End Function
End Module
Learn CAD Automation using NX Open & Automate Design Tasks in Less Than 90 Days Without Any Prior Knowledge.
Attend the NX Open Masterclass to Discover
What’s Popular
Browse Popular, evergreen tutorials and how-to guides.
This journal get’s the name material used in part. Imports SystemImports NXOpenModule NXJournalSub Main (ByVal args() As String)Dim theSession As NXOpen.Session = …
This journal get’s the name material used in part. Imports SystemImports NXOpenModule NXJournalSub Main (ByVal args() As String)Dim theSession As NXOpen.Session = …
Datum Planes are a planar reference feature to help define other features, such as swept bodies and features at angles to the …
The use of computer-aided design (CAD) software has become an essential tool in engineering and manufacturing. There is no industry today that …
An attribute is a persistant way to store non-geometric data (i.e. not a point or curve or solid or feature). Attributes can …
An attribute is a persistant way to store non-geometric data (i.e. not a point or curve or solid or feature). Attributes can …
Design Engineers always spend more time on drawings for several reasons. A few of them are; Drawings are prime source of information …
It is quite possible to create a blank part and drawing sheet with one click of a button. Yes, you are right, …
NX Open is a powerful tool for automating NX CAD tasks. Below is source code that creates a new blank prt file …
As engineers and designers, we often have to work with complex 3D models and drawings, and extracting important information from these can …
NX Open is a powerful tool for working with imported geometries in NX.One common task that engineers and designers may need to …
https://youtu.be/5NWHlSM0sQ0 Q:Can you teach me nx open using visual basic .net? ChatGPT: Yes, I can help you get started with using Visual …