Submitted by policep on Tue, 01/09/2018 - 03:30
Forums:
Hi All
I am working on layer setting checklist for drawing file
User will run the macro,macro has to move the objects as per below mentioned requirements
datum feature = should be in 100th layer
balloon feature = should be in 101 layer
datum target = should be in 102 layer
surface symbol = should be in 103 layer
welding symbol = should be in 104 layer
I did for sketches and fcfs & notes its working fine
please support on other objects mentioned in above.
Thank you
Reagrds
patil
Please any support on this
Please any support on this
Below code for notes
foreach (Note note in workPart.Notes)
{
DisplayableObject[] objects1 = new DisplayableObject[1];
objects1[0] = note;
DisplayModification displayModification1;
displayModification1 =
theSession.DisplayManager.NewDisplayModification();
displayModification1.NewLayer = 242;
displayModification1.Apply(objects1);
displayModification1.Dispose();
}
Thank you
Reagrds
Patil
re: annotations
The code below shows how to access the other object types.
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()
lw.WriteLine("number of datums: " & theSession.Parts.Work.Annotations.Datums.ToArray.Length.ToString)
lw.WriteLine("number of datum targets: " & theSession.Parts.Work.Annotations.DatumTargets.ToArray.Length.ToString)
lw.WriteLine("number of drafting datum targets: " & theSession.Parts.Work.Annotations.DraftingDatumTargets.ToArray.Length.ToString)
lw.WriteLine("number of feature control frames: " & theSession.Parts.Work.Annotations.Fcfs.ToArray.Length.ToString)
lw.WriteLine("number of GDT's: " & theSession.Parts.Work.Gdts.ToArray.Length.ToString)
For Each temp As NXObject In theSession.Parts.Work.Gdts
lw.WriteLine(" type: " & temp.GetType.ToString)
Next
lw.WriteLine("number of ID symbols: " & theSession.Parts.Work.Annotations.IdSymbols.ToArray.Length.ToString)
lw.WriteLine("number of surface finish symbols: " & theSession.Parts.Work.Annotations.DraftingSurfaceFinishSymbols.ToArray.Length.ToString)
lw.WriteLine("number of weld symbols: " & theSession.Parts.Work.Annotations.Welds.ToArray.Length.ToString)
lw.Close()
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
End Function
End Module
Also note that the display modification object's .Apply method will accept an array of objects, so you could simplify your code as below:
DisplayModification displayModification1;
displayModification1 =
theSession.DisplayManager.NewDisplayModification();
displayModification1.NewLayer = 242;
displayModification1.Apply(workPart.Notes.ToArray);
displayModification1.Dispose();
Thanks for your support
Thanks for your support
Manual edited dimensions
Hello Experts
Please support on this
All manual edited dimensions should be in 108 layer & manual edited dimensions are in yellow colour.
Thank you
re: manual dimensions
The code at the following link will find manual dimensions; it writes some info to the listing window, but you can modify it to do as you like.
http://nxjournaling.com/content/report-dimensions-manual-text
Thank you
Thank you