Export pdf from modeling, with dim or hidden edges?
Export pdf from modeling, with dim or hidden edges?
(OP)
Is it possible in NX8?
Thanks in advance
Thanks in advance
----
kukelyk
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS Come Join Us!Are you an
Engineering professional? Join Eng-Tips Forums!
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting GuidelinesJobs |
Export pdf from modeling, with dim or hidden edges?
|
Export pdf from modeling, with dim or hidden edges?Export pdf from modeling, with dim or hidden edges?(OP)
Is it possible in NX8?
Thanks in advance ---- Red Flag SubmittedThank you for helping keep Eng-Tips Forums free from inappropriate posts. Reply To This ThreadPosting in the Eng-Tips forums is a member-only feature.Click Here to join Eng-Tips and talk with other members! |
ResourcesThe world has changed considerably since the 1980s, when CAD first started displacing drafting tables. Download Now
Prototyping has always been a critical part of product development. Download Now
As the cloud is increasingly adopted for product development, questions remain as to just how cloud software tools compare to on-premise solutions. Download Now
Engineering-centric businesses face a number of challenges today, but unmanageable design and change processes don’t need to be counted among them. Download Now
|
RE: Export pdf from modeling, with dim or hidden edges?
- Preferences -> Visualization -> Visual
- General Display Settings, change rendering style to "Static Wireframe"
- Edge Display Settings, change hidden edges to invisible (or dashed, or gray thin)
- If you reorient your view at this point, you will notice that the hidden edges do not update automatically (use regenerate view if needed)
- Export your pdf
- Reset your view preferences
The invisible and dashed options work well, the "gray thin" option produced black lines in my test. I'm not sure if there is a way around that.www.nxjournaling.com
RE: Export pdf from modeling, with dim or hidden edges?
RE: Export pdf from modeling, with dim or hidden edges?
There was some fuzz some years ago when the dynamic mode hidden line became "a standard icon on the toolbar" ( -John will bash me for that) and the export such as pdf and cgm did not take the hidden lines into account. The fix has been there since then, (or a maintenance pack later) but the description in the menu, has been as difficult to understand since day one...
Preferences - Visualization - Visual - Edge display settings - Session settings - Infer edge output = on.
- Will export hidden edges in pdf's etc as expected.
Regards,
Tomas
RE: Export pdf from modeling, with dim or hidden edges?
Thanks for the heads up, I missed that one.
Fortunately, I don't do a lot of exporting from the model view so it hasn't really been an issue for me.
www.nxjournaling.com
RE: Export pdf from modeling, with dim or hidden edges?
Now, if You came here, I tell what I want:
export a jpg, from a dual-view layout, with Csys, for the workshop.
My postprocessor list data to a html-file, but it need some drawing, picture, or something like that.
The exported jpg could be better, because it can be easily link into the html. But, when I print the html, it would be better, if the picture contained no empty areas around the views. I found some code, what can crop the picture, but still not works.
I have a journal, what exports the pdf, labelled with the filename, but there were this hidden-line problem.
Unfortunately my programming skills are not so strong, but I do not give it up, somebody hopefully will help me.
http://tek-tips.com/viewthread.cfm?qid=1694947
----
kukelyk
RE: Export pdf from modeling, with dim or hidden edges?
What code do you have so far (is the code posted in the tek-tips thread all of it)?
www.nxjournaling.com
RE: Export pdf from modeling, with dim or hidden edges?
my post creates a html, where the filename same as the prt's, the jpg also.
the html code will contain this default image name..(if there is no picture, there will be a hole in the html page)
----
kukelyk
RE: Export pdf from modeling, with dim or hidden edges?
www.nxjournaling.com
RE: Export pdf from modeling, with dim or hidden edges?
----
kukelyk
RE: Export pdf from modeling, with dim or hidden edges?
CODE
Option Strict Off Imports System Imports NXOpen Imports NXOpen.UF Module Module1 Sub Main() Dim theSession As Session = Session.GetSession() Dim ufs As UFSession = UFSession.GetUFSession() Dim workPart As Part = theSession.Parts.Work Dim fitPercent As Integer = theSession.Preferences.ScreenVisualization.FitPercentage theSession.Preferences.ScreenVisualization.FitPercentage = 100 workPart.ModelingViews.WorkView.Orient(View.Canned.Trimetric) workPart.ModelingViews.WorkView.Fit() Dim prtJpg As String = Left(workPart.FullPath, Len(workPart.FullPath) - 3) & "jpg" ufs.Disp.CreateImage(prtJpg, UFDisp.ImageFormat.Jpeg, UFDisp.BackgroundColor.White) theSession.Preferences.ScreenVisualization.FitPercentage = fitPercent End Sub Public Function GetUnloadOption(ByVal dummy As String) As Integer 'Unloads the image when the NX session terminates GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination End Function End ModuleThe above code changes the view fit percentage to 100%, changes the model orientation to trimetric, performs a view fit, exports a jpg with the same name as the file to the same directory as the file, and finally resets the view fit % to the previous value.
www.nxjournaling.com
RE: Export pdf from modeling, with dim or hidden edges?
Line 17: Value of 'NXOpen.View.Canned'cannot be converted to NXOpen.Matrix3x3'.
What is the problem?
My code is in this stage:
CODE
Option Strict Off Imports System Imports NXOpen Imports Microsoft.VisualBasic Imports System.Drawing Imports System.Drawing.Graphics Imports NXOpen.BasePart Imports NXOpen.UF Module NXJournal Sub Main Dim theSession As Session = Session.GetSession() Dim theUI As UI = UI.GetUI() Dim workPart As Part = theSession.Parts.Work Dim displayPart As Part = theSession.Parts.Display ' ---------------------------------------------- ' Open 'L2' Layout, Replace View->TOP&FRONT ' ---------------------------------------------- Dim currentLayout as String = workPart.Layouts.Current.Name Dim layout1 As Layout = CType(workPart.Layouts.FindObject("L2"), Layout) If currentLayout <> "L2" Then layout1.Open() End If Dim leftSideTop As ModelingView = CType(workPart.ModelingViews.FindObject("TOP"), ModelingView) layout1.ReplaceView(workPart.ModelingViews.WorkView, leftSideTop, True) Dim rightSideDefault As ModelingView = CType(workPart.ModelingViews.FindObject("RIGHT"), ModelingView) Dim rightSideFront As ModelingView = CType(workPart.ModelingViews.FindObject("FRONT"), ModelingView) layout1.ReplaceView(rightSideDefault, rightSideFront, True) ' ---------------------------------------------- ' Static Wireframe ' ---------------------------------------------- leftSideTop.RenderingStyle = View.RenderingStyleType.StaticWireframe rightSideFront.RenderingStyle = View.RenderingStyleType.StaticWireframe ' ---------------------------------------------- ' Update Display ' ---------------------------------------------- rightSideFront.UpdateDisplay() leftSideTop.UpdateDisplay() ' ---------------------------------------------- ' View triad OFF ' ---------------------------------------------- Dim sesPrefs = theSession.Preferences sesPrefs.ScreenVisualization.TriadVisibility = 0 ' ---------------------------------------------- ' JPG_output ' ---------------------------------------------- 'Dim WorkDir As String Dim Work_part As String Dim SetupJpg as string Dim Line as string Dim ufs As UFSession = UFSession.GetUFSession() Dim LineLength As Integer SetupJpg = theSession.Parts.Work.FullPath 'read NX internal variable SetupJpg = Replace (SetupJpg, "prt", "jpg") ufs.Disp.CreateImage(SetupJpg, UFDisp.ImageFormat.Jpeg, UFDisp.BackgroundColor.White) LineLength = Len( SetupJpg ) While LineLength > 0 LineLength = LineLength-1 Line &= "-" End While theSession.ListingWindow.Open theSession.ListingWindow.WriteLine( Line ) theSession.ListingWindow.WriteLine( SetupJpg ) theSession.ListingWindow.WriteLine( Line ) ' ---------------------------------------------- ' Restore L1 layout ' ---------------------------------------------- Dim SingleView As Layout = CType(workPart.Layouts.FindObject("L1"), Layout) SingleView.Open() workPart.ModelingViews.WorkView.Fit() ' ---------------------------------------------- ' View triad ON ' ---------------------------------------------- sesPrefs.ScreenVisualization.TriadVisibility = 1 ' ---------------------------------------------- ' Reread exported JPG file, and crop ' ---------------------------------------------- Dim origJPG As New Bitmap( SetupJpg ) Dim JPGminX As Integer = origJPG.Width Dim JPGminY As Integer = origJPG.Height Dim JPGmaxX As Integer = 0 Dim JPGmaxY As Integer = 0 Dim bckgrndColor As Color = Color.White For y As Integer = 0 To origJPG.Height - 1 For x As Integer = 0 To origJPG.Width - 1 If origJPG.GetPixel(x, y).ToArgb <> bckgrndColor.ToArgb Then If x < JPGminX Then JPGminX = x ElseIf x > JPGmaxX Then JPGmaxX = x End If If y < JPGminY Then JPGminY = y ElseIf y > JPGmaxY Then JPGmaxY = y End If End If Next Next Dim rect As New Rectangle(JPGminX, JPGminY, JPGmaxX - JPGminX + 1, JPGmaxY - JPGminY + 1) Dim cropped As Bitmap = origJPG.Clone(rect, origJPG.PixelFormat) ' Close the image files. origJPG.Dispose() cropped.Save(SetupJpg, System.Drawing.Imaging.ImageFormat.Jpeg) End Sub End Module it exports a JPG, and crop it correctly, the first time. If I run it once again, the model disappears before the export, and the jpg contains only the WCS... does anyone know why?----
kukelyk
RE: Export pdf from modeling, with dim or hidden edges?
CODE
with this line
CODE
Looks like you wouldn't need that line in your code at all since you aren't reorienting views but rather using existing layouts.
www.nxjournaling.com
RE: Export pdf from modeling, with dim or hidden edges?
CODE
www.nxjournaling.com
RE: Export pdf from modeling, with dim or hidden edges?
----
kukelyk