Author Topic: Purge (Missing) STB Plot Styles  (Read 2261 times)

0 Members and 1 Guest are viewing this topic.

tombu

  • Bull Frog
  • Posts: 288
  • ByLayer=>Not0
Purge (Missing) STB Plot Styles
« on: July 25, 2020, 02:47:25 PM »
Has anyone figured out a way to do this?
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Purge (Missing) STB Plot Styles
« Reply #1 on: July 26, 2020, 08:23:32 AM »
The word purge is a bit confusing. Do you want to replace STB styles that are references in the DWG but cannot be found in an STB file?

tombu

  • Bull Frog
  • Posts: 288
  • ByLayer=>Not0
Re: Purge (Missing) STB Plot Styles
« Reply #2 on: July 27, 2020, 11:24:02 AM »
The word purge is a bit confusing. Do you want to replace STB styles that are references in the DWG but cannot be found in an STB file?
Merge would be the best solution as I know the STB some of them refer to and would like to merge them to a similar Plot Style. To purge or remove them may cause issues if they were assigned to an object even inside a block. Not sure if any of them are referenced any objects in the drawing.

None of them display in the regular PLOTSTYLE dialog box, with a selected object trying to change Plot Style in Properties Palette they show up in the "Select Plot Style" dialog box.
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

tombu

  • Bull Frog
  • Posts: 288
  • ByLayer=>Not0
Re: Purge (Missing) STB Plot Styles
« Reply #3 on: July 27, 2020, 01:17:20 PM »
I've attached our FDOT.stb STB file and our _civil 3d (fdot) ncs.dwt drawing template file and a saved down _civil 3d (fdot) ncs 2013.dwg 3013 version for anyone to check out.

They don't show in the PLOTSTYLE command in newer releases for setting the current Plot Style but they're still in the drawing. To see the (missing) ones draw a line, select it and click other when changing the Plot Style of the object in the Properties Palette.
« Last Edit: July 27, 2020, 01:36:51 PM by tombu »
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Purge (Missing) STB Plot Styles
« Reply #4 on: July 27, 2020, 04:17:38 PM »
1. Loop over all objects in all blocks and change their plotstylename property based on an assoc list.
2. Do the same for all layers.
3. Purge the faulty plot styles with the _Purge command or by deleting them from the ACAD_PLOTSTYLENAME dictionary.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Purge (Missing) STB Plot Styles
« Reply #5 on: July 27, 2020, 04:38:56 PM »
BTW if I run _Audit on the template 46 errors are reported (note: I use BricsCAD). You may want to fix that.

tombu

  • Bull Frog
  • Posts: 288
  • ByLayer=>Not0
Re: Purge (Missing) STB Plot Styles
« Reply #6 on: July 27, 2020, 05:16:50 PM »
BTW if I run _Audit on the template 46 errors are reported (note: I use BricsCAD). You may want to fix that.
Thanks, but already tried Audit and Recover, difference may be I'm using AutoCAD Civil 3D 2021 with a lot of intelligent objects?
1. Loop over all objects in all blocks and change their plotstylename property based on an assoc list.
2. Do the same for all layers.
3. Purge the faulty plot styles with the _Purge command or by deleting them from the ACAD_PLOTSTYLENAME dictionary.
Blank Civil template with many block definitions. Could lisp "Loop over all objects in all blocks and change their plotstylename property based on an assoc list"? That's what I'm looking for. Something that would take a missing Plot Style and replace it with one from FDOT.stb and remove the missing one from the drawing completely. I'd like to run it on drawings already created as well.
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Purge (Missing) STB Plot Styles
« Reply #7 on: July 28, 2020, 05:03:28 AM »
AutoCAD Civil 3D 2021 with a lot of intelligent objects?
Or with a not so clever _Audit command?

The Audit issues that are reported in the DWT are:
Code: [Select]
: AUDIT
Fix any errors detected? [Yes/No] <No>:y

Name: AcDbTableStyle(D969)
Value: TextStyle ((0))
Validation: Invalid
Replaced by: Set to Default

Name: AcDbTableStyle(D969)
Value: TextStyle ((0))
Validation: Invalid
Replaced by: Set to Default

Name: AcDbTableStyle(D969)
Value: TextStyle ((0))
Validation: Invalid
Replaced by: Set to Default

Name: AcDbProxyObject(3274)
Value: Owner Id (1DC1)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3273)

Name: AcDbProxyObject(3275)
Value: Owner Id (1DC2)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3273)

Name: AcDbProxyObject(3276)
Value: Owner Id (1DC3)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3273)

Name: AcDbProxyObject(3277)
Value: Owner Id (1DC4)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3273)

Name: AcDbProxyObject(3278)
Value: Owner Id (1DC5)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3273)

Name: AcDbProxyObject(326E)
Value: Owner Id (1DC1)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(326D)

Name: AcDbProxyObject(326F)
Value: Owner Id (1DC2)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(326D)

Name: AcDbProxyObject(3270)
Value: Owner Id (1DC3)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(326D)

Name: AcDbProxyObject(3271)
Value: Owner Id (1DC4)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(326D)

Name: AcDbProxyObject(3272)
Value: Owner Id (1DC5)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(326D)

Name: AcDbProxyObject(3246)
Value: Owner Id (1DD3)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3245)

Name: AcDbProxyObject(3247)
Value: Owner Id (1DD4)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3245)

Name: AcDbProxyObject(3248)
Value: Owner Id (1DD5)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3245)

Name: AcDbProxyObject(3242)
Value: Owner Id (1DD3)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3241)

Name: AcDbProxyObject(3243)
Value: Owner Id (1DD4)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3241)

Name: AcDbProxyObject(3244)
Value: Owner Id (1DD5)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3241)

Name: AcDbProxyObject(37F0)
Value: Owner Id (3536)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(37EF)

Name: AcDbProxyObject(37F1)
Value: Owner Id (3537)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(37EF)

Name: AcDbProxyObject(37F2)
Value: Owner Id (3538)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(37EF)

Name: AcDbProxyObject(37F3)
Value: Owner Id (3539)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(37EF)

Name: AcDbProxyObject(37F4)
Value: Owner Id (353A)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(37EF)

Name: AcDbProxyObject(37F5)
Value: Owner Id (353B)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(37EF)

Name: AcDbProxyObject(37F6)
Value: Owner Id (37E3)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(37EF)

Name: AcDbProxyObject(3255)
Value: Owner Id (244F)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3254)

Name: AcDbProxyObject(3256)
Value: Owner Id (2450)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3254)

Name: AcDbProxyObject(3257)
Value: Owner Id (2451)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3254)

Name: AcDbProxyObject(3258)
Value: Owner Id (2452)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3254)

Name: AcDbProxyObject(3259)
Value: Owner Id (2453)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3254)

Name: AcDbProxyObject(325A)
Value: Owner Id (2454)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3254)

Name: AcDbProxyObject(325B)
Value: Owner Id (2455)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3254)

Name: AcDbProxyObject(325C)
Value: Owner Id (2456)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3254)

Name: AcDbProxyObject(325D)
Value: Owner Id (2457)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3254)

Name: AcDbProxyObject(325E)
Value: Owner Id (2458)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3254)

Name: AcDbProxyObject(324A)
Value: Owner Id (244F)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3249)

Name: AcDbProxyObject(324B)
Value: Owner Id (2450)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3249)

Name: AcDbProxyObject(324C)
Value: Owner Id (2451)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3249)

Name: AcDbProxyObject(324D)
Value: Owner Id (2452)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3249)

Name: AcDbProxyObject(324E)
Value: Owner Id (2453)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3249)

Name: AcDbProxyObject(324F)
Value: Owner Id (2454)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3249)

Name: AcDbProxyObject(3250)
Value: Owner Id (2455)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3249)

Name: AcDbProxyObject(3251)
Value: Owner Id (2456)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3249)

Name: AcDbProxyObject(3252)
Value: Owner Id (2457)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3249)

Name: AcDbProxyObject(3253)
Value: Owner Id (2458)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(3249)

14668 objects audited
Total errors found during audit 46, fixed 46

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Purge (Missing) STB Plot Styles
« Reply #8 on: July 28, 2020, 05:14:59 AM »
To get back to the main issue:

The DWG and DWT are special somehow. I suspect that the 'Vertical' you use creates hard references to plotstyle names, preventing them from being purged. Maybe some proxy objects reference plotstyle names?

One peculiar thing I was able to pin-point is that some "AcDb2dVertex" objects have a plotstyle name that does not match that of their "AcDb2dPolyline" parent. The code below tries to fix that.

After using the code below only the "Solid" plotstyle can be purged. The other faulty styles ("30% Screen", "40% Screen" and "Style_1") can be erased from the ACAD_PLOTSTYLENAME dictionary, but that seems unwise.

Code - Auto/Visual Lisp: [Select]
  1. ; Plotsyles in DWG and DWT:
  2. ;   "125"
  3. ;   "175"
  4. ;   "255"
  5. ;   "30% Screen"  ; Not in STB.
  6. ;   "40% Screen"  ; Not in STB.
  7. ;   "Normal"
  8. ;   "Solid"       ; Not in STB.
  9. ;   "Style_1"     ; Not in STB.
  10.  
  11. ; (vla-put-plotstylename (vlax-ename->vla-object (car (entsel))) "000")
  12.  
  13. (defun Plotstyle_Update (obj / fnf lst)
  14.   (setq lst ; Translation list.
  15.     '(
  16.       ("30% Screen" . "175")
  17.       ("40% Screen" . "175")
  18.       ("Solid"      . "255")
  19.       ("Style_1"    . "Normal")
  20.     )
  21.   )
  22.   ;; Fix 2d poly issue:
  23.   ;; Some "AcDb2dVertex" objects have a plotstyle name that does not match that of their "AcDb2dPolyline" parent.
  24.   (if (= "AcDb2dPolyline" (vla-get-objectname obj))
  25.     (Plotstyle_Fix2dPoly obj)
  26.   )
  27.   (if (setq fnd (assoc (vla-get-plotstylename obj) lst))
  28.     (progn
  29.       (vla-put-plotstylename obj (cdr fnd))
  30.       T
  31.     )
  32.   )
  33. )
  34.  
  35. (defun Plotstyle_Fix2dPoly (obj / old) ; Workaround.
  36.     obj
  37.     (if (= "BYLAYER" (strcase old))
  38.       "ByBlock"
  39.       "ByLayer"
  40.     )
  41.   )
  42. )
  43.  
  44. (defun c:Plotstyle_Remap ( / cnt doc)
  45.   (setq cnt 0)
  46.   (vlax-for blk (vla-get-blocks doc)
  47.     (vlax-for obj blk
  48.       (if (Plotstyle_Update obj) (setq cnt (1+ cnt)))
  49.     )
  50.   )
  51.   (vlax-for lyr (vla-get-layers doc)
  52.     (if (Plotstyle_Update lyr) (setq cnt (1+ cnt)))
  53.   )
  54.   (princ (strcat "\n " (itoa cnt) "x plotstyle name remapped "))
  55.   (princ)
  56. )
« Last Edit: July 28, 2020, 08:52:05 AM by roy_043 »

tombu

  • Bull Frog
  • Posts: 288
  • ByLayer=>Not0
Re: Purge (Missing) STB Plot Styles
« Reply #9 on: July 28, 2020, 02:43:47 PM »
 :idiot2:I ran AUDIT again and fixed all the errors. I'd played with the template for quite a while trying to fix it and must have put the errors back in or deleted the wrong copy somehow.

Plot Styles from Autodesk-MONO.stb I'd first used:
Solid, 10% to 90% Screen, Color, & Normal

First CTB I ever converted created Style_1
Default when there isn't one.

Plotstyle_Remap didn't get me all the way but thank you for all you've done.

I'd backup first, but as I can't imagine what ("30% Screen", "40% Screen" and "Style_1") could still be used for I'd sure like to see how they can be erased from the ACAD_PLOTSTYLENAME dictionary. I haven't done any code with dictionaries before and would love to see it.
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Purge (Missing) STB Plot Styles
« Reply #10 on: July 28, 2020, 02:49:07 PM »
I suspect that the 'Vertical' you use creates hard references to plotstyle names, preventing them from being purged.
That is indeed the case. The object listed below is the culprit.
Code: [Select]
(
  (-1 . <Entity name: 54110da0>)
  (0 . "ACAD_PROXY_OBJECT")
  (5 . "859A")
  (330 . <Entity name: 53b35360>)
  (100 . "AcDbProxyObject")
  (90 . 499)
  (1 . "AeccDbSurfaceStyle")
  (71 . 33)
  (97 . 0)
  (70 . 0)
  (162 . 4700)
  (311 . "48D0C01BC01B801D001BC01D401C801CC008000C000B800C4009C0080018401B80190008000C000B800D4009C008000A001080184018C01AC019C01C801BC01D401B8019000A401345300750072006600610063006500200063006F006E0074006F00750072007300200061007400200031002700200061006E006400200035002700200069006E00740065007200760061006C007300200028004200610063006B00670072006F0075006E00640029004048001084100750074006F006400650073006B00468C400EC00C000EC00C000EC00C400C000C000B800C000EC00C000B800C000EC00C800B800C000EC01040138014C012400CC00C4010120004048001012000425080194018401D4019801BC01C80190015001012000468C400EC00C000EC00C000EC00C400C000C000B800C000EC00C000B800C000EC00C800B800C000EC01040138014C012400CC00C401012B00468C400EC00C000EC00C000EC00C400C000C000B800C000EC00C000B800C000EC00C800B800C000EC0114014C010C012001140148010120004048001075200610069006E0062006F007700468C400EC00C000EC00C000EC00C400C000C000B800C000EC00C000B800C000EC00C800B800C000EC01040138014C012400CC00DC01012000464C400EC00C000EC00C000EC00C400C000C000B800C000EC00C000B800C000EC00C800B800C000EC01140104014801500120011A31003B0030003B0030003B003100300030002E0030003B0030002E0030003B0032002E0030003B0041004E005300490033003200AAAAAAAAAAAAAAAAAAAAAAAAA0")
  (161 . 13793)
  (330 . <Entity name: 4c7ca440>)
  (330 . <Entity name: 4c7cac40>)
  (330 . <Entity name: 4c7ca440>)
  (330 . <Entity name: 4c7ca440>)
  (330 . <Entity name: 4c7ca440>)
  (330 . <Entity name: 4c7ca440>)
  (330 . <Entity name: 4c7ca440>)
  (330 . <Entity name: 4c7ca440>)
  (330 . <Entity name: 4c7cac40>)
  (330 . <Entity name: 4c7cac40>)
  (330 . <Entity name: 4c7ca440>)
  (330 . <Entity name: 4c7ca440>)
  (330 . <Entity name: 4c7cac40>)
  (330 . <Entity name: 4c7ca440>)
  (330 . <Entity name: 4c7ca440>)
  (340 . <Entity name: 4c7c7540>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7c7680>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7c7bc0>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7c7880>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 54110ba0>)
  (340 . <Entity name: 4c7c7c00>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 5411ae60>)
  (340 . <Entity name: 4c7c7840>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7c7540>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7cacc0>)
  (340 . <Entity name: 4c7cae40>)
  (340 . <Entity name: 4c7cacc0>)
  (340 . <Entity name: 4c7cae40>)
  (340 . <Entity name: 4c7cacc0>)
  (340 . <Entity name: 4c7cae40>)
  (340 . <Entity name: 4c7cacc0>)
  (340 . <Entity name: 4c7cae40>)
  (340 . <Entity name: 4c7c8240>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7c7540>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7c7680>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7c7bc0>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7c7880>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7c7c00>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7c7840>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7cacc0>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7cacc0>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7cacc0>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7cacc0>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7cacc0>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7c8240>)
  (340 . <Entity name: 4c7ca5c0>)
  (340 . <Entity name: 4c7cacc0>)
  (340 . <Entity name: 4c7ca5c0>)
  (94 . 0)
)

tombu

  • Bull Frog
  • Posts: 288
  • ByLayer=>Not0
Re: Purge (Missing) STB Plot Styles
« Reply #11 on: July 28, 2020, 03:37:48 PM »
I suspect that the 'Vertical' you use creates hard references to plotstyle names, preventing them from being purged.
That is indeed the case. The object listed below is the culprit.
No name listed for that Surface Style but they're easily recreated if there's some way of deleting it. I've added and modified the ones I use so it's probably one of them. I could remake it quickly from a modified copy of another.

If there was some way of getting the name of the Surface Style I could delete it myself without code. Otherwise there's a lot of Surface Styles in there.
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Purge (Missing) STB Plot Styles
« Reply #12 on: July 28, 2020, 04:45:24 PM »
Since you know the handle you can delete the object in this manner:
Code - Auto/Visual Lisp: [Select]
  1. (entdel (handent "859A"))

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Purge (Missing) STB Plot Styles
« Reply #13 on: July 28, 2020, 04:59:51 PM »
Note that you should check/update the translation list in the Plotstyle_Update function before using the remap code.