Hello esteemed CDR &CorelDESIGNER API Members, and thanks for such excellent programming, scripts and productive support.1) I hoped you might please advise how to use cdrTraceType cdrTraceLineDrawing which FAILS, only producing a single linear path instead of CENTERLINE trace?When using cdrTraceLineArt the same macros below WORK, producing vectorized OUTLINE paths from bitmap textures:(please feel free to forward this to anyone who may instruct remedy. Thanks for any help, Jeff)(2) Bitmap Trace via With(reference) to ActivePage Shapes:Sub TraceActivePage() Dim s As Shape, sr As ShapeRange, p As Page For Each p In ActiveDocument.Pages p.Activate Set sr = ActivePage.Shapes.FindShapes(, cdrBitmapShape) Set s = ActiveShape For Each s In sr With s.Bitmap.Trace(cdrTraceLineDrawing, 25, 100, cdrColorBlackAndWhite, cdrUniform, , True, True, True) .Finish End With Next s Next pEnd Sub(1) Bitmap Trace via Set(parameter) TraceSettings:Sub TraceSettings()Dim s As Shape, sr As ShapeRangeDim t As TraceSettingsFor Each s In ActivePage.FindShapes(, cdrBitmapShape) Set t = s.Bitmap.Trace(cdrTraceLineDrawing, 25, 100, cdrColorBlackAndWhite, cdrUniform, , True, True, True) t.Finish Next s Set t = Nothing Set s = NothingEnd Sub
Hello, already in the New Year.
Could you make a visual example of what is not working/what you would like to achieve? Because on my side running the scripts seems to work as needed, making center line traced outline objects...
Hi Joe, Happier New Year, really appreciate your reply and confirmation the scripts work on your system and CorelDRAW version.I assume you ran the scripts as is, or please let know of any changes?2) please confirm you substituted cdrTraceLineDrawing in place of cdrTraceLineArt in the scripts?, and did cdrTraceLineDrawing work?,3) please let know which version of CorelDRAW, and on what system your successfully running the cdrTraceLineDrawing script?, (my system configs are at end)..Screenshot "1_.." is a frame 572 of project footage,screenshot 1a_, is Manual Bitmaps > Centerline trace > Line Drawing results,screenshot 1b_, is Manual centerline trace Curve results,screenshot 2_, is script 2), function TraceSettings used with working cdrTraceLineArt enumerator,screenshot 3_, is TraceSetting script Successful results bitmap tracing Outlines,screenshot 4_, is TraceSetting script Failure with cdrTraceLineDrawing, producing only linear path instead of bitmap tracing Centerlines.I plan to achieve a script that converts each CDR bitmap-Layer to a Centerline Trace, Line Drawing.Look forward to talk soon,thx again,JeffSystem Configuration:O.S. : Windows 7 64 Bit,MOTHERBOARD : Supermicro MDB-H8QII-F-O,CHASSIS : Cooler Master HAF 932 RC-932-KKN1-GP, STWX, fits SSI-MEB,CPU(S) : 4x AMD Opteron 8435 6 cores, installed in CPU1 thru CPU4,CPU COOLERS : 4x Supermicro SNK-P0024AP4,PSU : Silverstone Strider Gold, 1200 Watt PSU,MEMORY : Hynix ECC Registered 800ghz 4x4Gb = 16Gb total (in dimm 1a/1b on CPU1 thru CPU4),HARD DRIVE : 500 gb SSD with Windows 7 64 bit installed,VIDEO CARD : 2x NVidia GTX 690's in Quad SLI,MONITOR : Samsung S27A950D monitor/3DTV connected via DVI
Hi Joe, Happier New Year, really appreciate your reply and confirmation the scripts work on your system and CorelDRAW version.I assume you ran the scripts as is, or please let know of any changes?2) please confirm you substituted cdrTraceLineDrawing in place of cdrTraceLineArt in the scripts?, and did cdrTraceLineDrawing work?,3) please let know which version of CorelDRAW, and on what system your successfully running the cdrTraceLineDrawing script?, (i'm using Win7 &i tried to list complete system configs below, but the "Brand" names we're apparently flagged as advertisements)..Screenshot "1_.." is a frame 572 of project footage,screenshot 1a_, is Manual Bitmaps > Centerline trace > Line Drawing results,screenshot 1b_, is Manual centerline trace Curve results,screenshot 2_, is script 2), function TraceSettings used with working cdrTraceLineArt enumerator,screenshot 3_, is TraceSetting script Successful results bitmap tracing Outlines,screenshot 4_, is TraceSetting script Failure with cdrTraceLineDrawing, producing only linear path instead of bitmap tracing Centerlines.I plan to achieve a script that converts each CDR bitmap-Layer to a Centerline Trace, Line Drawing.Look forward to talk soon,thx again,Jeff
Now I get it!
As far as I can tell it was using the DetailLevelPercent of 100 with the original image. Seems like it does the exact opposite of what it sounds like.
One option is to lower that value, but to me it feels like making a sort-of preview image where you can adjust the settings a little better isn't a bad idea either. So I changed your code a little:
Sub TraceEachPage() Dim ShapeToTrace As Shape, BitmapsToTrace As ShapeRange, PagesToTrace As Page For Each PagesToTrace In ActiveDocument.Pages PagesToTrace.Activate Set BitmapsToTrace = ActivePage.Shapes.FindShapes(, cdrBitmapShape) Set ShapeToTrace = ActiveShape For Each ShapeToTrace In BitmapsToTrace ShapeToTrace.Bitmap.ConvertToBW cdrRenderLineArt, 100, 24 With ShapeToTrace.Bitmap.Trace(cdrTraceLineDrawing, 25, 50, cdrColorBlackAndWhite, , 2, True, True) .Finish End With Next ShapeToTrace Next PagesToTrace End Sub
You can comment out the trace lines and adjust that 24 number up and down a little to see how close to a clear linework you can get that initial image. Then go back to tracing and the results should be close to what you wanted.
Or, if the less detailed version you have as an example is what you want just change the 100 in your original code.
May I ask what the final use of this is? Was just wondering, since that middle line trace does not look that great, no matter what you adjust.
Thanks again Joe, great news and diagnostic, just got in for parameter update,i'd tried the scripts with DetailLevelPercent = 80, which evidently still high enough to render no curves since setting only prolificates centerlines at lower values. So my Manual(image 1b) trace settings (D45, s80, cs75) will work, awesome!(this inverted order of Detail and Smoothing in trace window, is reason i adjusted smoothing in scripts thinking it detail, while actually leaving it at 100)4) were the following Bitmap method, enumerator &settings also required for cdrTraceLineDrawing to render?, (really good to know thx, also for line quality control, found neither used in tracing script examples) ShapeToTrace.Bitmap.ConvertToBW cdrRenderLineArt, 100, 24- also assume this the line you mentioned 'can comment out?,Yes, images 1a-1b is desired version, these cleanable but accurate Centerlines are used in semi&fully-automated 2.2.3D(tm), cinematic conversion methods.Hope Corel also recognizes your value, CDR's great but they don't know or support VBA automation, esp. for the obscure and undocumented as much of equivalent scripting language.Appreciate it,looking forward,Jeff