BlockView-DisplayDWG - problems with drawing order

Started by Peter2, July 26, 2016, 10:27:03 AM

Previous topic - Next topic

Peter2

I made some traffic signs, e.g. the "Stop" sign - only red and white hatch pattern ("Solid"). Now I have problems to display it correct - see attachment. It is OK in "DWG Thumbnail" (Explorer) and when opening in AutoCAD and with CAD-viewer from Cadsofttools. Same problems with most of the other signs too - are there any hints to solve it? When creating the drawing I had to use rather often the command "drawing order" ...
I used this code
Code (autolisp) Select
(dcl-BlockView-DisplayDwg Signaltafel/Signaltafel/SigTaf_Block1 strDwgFileName)
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

Fred Tomke

Yeah, I know this, unfortunately. I had some tests with the render mode property. 2d optimized works at its best for me. The other point was to select the objects in the right order when creating the block: do not select them by window but each single drawing entity beginning in the background (solids) and going to front. The latest entity is the top most element.
Hope the minimizes the effect. Otherwise you have to substract the text's boundary from the background solid. :(

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Peter2

Quote from: Fred Tomke on August 16, 2016, 04:47:11 AM
... the right order when creating the block....
The traffic sign are not blocks inside a DWG, they are single DWGs for its own (see attachment above) - with some problems of drawing order too ...
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

Fred Tomke

Hi, I've created a sample and added a ticket. Please note (but I'm sure you already know this), that FileExplorer and DWGPreview are using the thumbnail while BlockView is using GSView. I recommend you to use DWGPreview instead of BlockView for symbol libraries.
Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Peter2

Thanks Fred

I made a dialogue with displays all current types of display - see attachment. The problem of DWGview and DWGListe is the huge unused / wasted area:
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

roy_043

You can solve the issue by changing the 'hard order' (the order in which the entities have been created). To do this manually you would have to create in-place copies of entities in the right order and then erase the originals. This would not be easy and you would probably lose some associativity. But with some Lisp code you can automate this process:
Code (autolisp) Select
; (KGA_Block_DrawOrder_To_HardOrder (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
(defun KGA_Block_DrawOrder_To_HardOrder (blkObj / newLst oldLst sortArr sortTblObj)
  (if
    (and
      (= :vlax-false (vla-get-isxref blkObj))
      (= :vlax-true (vla-get-hasextensiondictionary blkObj))
      (not
        (vl-catch-all-error-p
          (setq sortTblObj
            (vl-catch-all-apply
              'vla-item
              (list (vla-getextensiondictionary blkObj) "ACAD_SORTENTS")
            )
          )
        )
      )
    )
    (progn
      (vla-getfulldraworder sortTblObj 'sortArr :vlax-false)
      (setq oldLst (mapcar 'vlax-variant-value (vlax-safearray->list sortArr)))
      (if (setq newLst (vlax-invoke (vla-get-database blkObj) 'copyobjects oldLst))
        (mapcar 'vla-delete oldLst)
      )
      newLst
    )
  )
)



Fred Tomke

Hi,

unfortunately, I had some troubles in the past with the ACAD_SORTENTS-Diactionary: in many cases the order of entities in the list did not match to the current drawingorder.

Peter, do you remember this post? There you can see a sample using DWGPreview. The key is to place the model correctly in the moment before saving the "symbol" to get the right preview.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Peter2

I used the current project with the display of existing WMF, but for further projects it could be important again.

Quote from: Fred Tomke on August 18, 2016, 01:29:56 PM
...to place the model correctly in the moment before saving the "symbol" to get the right preview.
...
You mean that I have to fit the size of my Acad-window to the proportion of the drawing, so for my traffic-signs I need a window with width=height (proportion = square)?
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

Fred Tomke

No, I meant it right inversely: zoom to the extents of the symbol before saving. But you are right: resizing AutoCAD window that the ratio of the window is equal to the symbol could help.
The both pictures demonstrate it quite well: for the first one I zoomed to the symbol's extents right before saving.
Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

roy_043

Quote from: Fred Tomke on August 18, 2016, 01:29:56 PMunfortunately, I had some troubles in the past with the ACAD_SORTENTS-Diactionary: in many cases the order of entities in the list did not match to the current drawingorder.
I use BricsCAD and I have not come across any issues with the ACAD_SORTENTS dictionary. I believe Peter2 uses BricsCAD as well.

Peter2

Quote from: roy_043 on August 19, 2016, 12:32:32 AM
.. I believe Peter2 uses BricsCAD as well.
Yes, I use (develop for ..) both AutoCAD and BricsCAD.
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10