Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to delete a linetype in drawings?

37 REPLIES 37
SOLVED
Reply
Message 1 of 38
aqdam1978
8105 Views, 37 Replies

how to delete a linetype in drawings?

Hi,

 

I have some drawing that contains PHANTOM2 linetype.

I can't delete this linetype from my drawings!

does anybody has any idea?

 

Please see the attached drawing.

 

Thanks,

Abbas

 

37 REPLIES 37
Message 21 of 38
mid-awe
in reply to: aqdam1978

I also tried the WBlock option just as Henrique described and it did not remove the Phantom2 reference. Maybe it's a AC2013 thing?
Message 22 of 38
hmsilva
in reply to: aqdam1978


@aqdam1978 wrote:

Hi Henrique,

 

yes, I did it both via WBLOCK dialog and also by lisp.

 

disappointed 😞

 


Abbas, I understand your disappointment...

I tested in versions 2010, 2012 and 2014 with success... but I can't test in AC2013...

 

Henrique

 

EESignature

Message 23 of 38
aqdam1978
in reply to: hmsilva

Hi Henrique,

 

I'm thinking about DICTIONARIES in drawing.

I found these dictionaries in the drawing:

 

ACAD_CIP_PREVIOUS_PRODUCT_INFO   = 1
ACAD_COLOR    = 1
ACAD_DETAILVIEWSTYLE       = 2
ACAD_GROUP    = 1
ACAD_LAYOUT     = 4
ACAD_MATERIAL       = 4
ACAD_MLEADERSTYLE    = 2
ACAD_MLINESTYLE  = 2
ACAD_PLOTSETTINGS    = 1
ACAD_PLOTSTYLENAME     = 2
ACAD_SCALELIST = 18
ACAD_SECTIONVIEWSTYLE = 2
ACAD_TABLESTYLE  = 2
ACAD_VISUALSTYLE   = 25
AcDbVariableDictionary  = 1313

 

I don't know can do we find PHANTOM2 in dictionaries and remove it by DICTREMOVE command?

 

Thanks,

 

Abbas

 

 

Message 24 of 38
hmsilva
in reply to: aqdam1978

Hi Abbas,

sorry for the late reply, I was working on a deadline for a while.

 

Your dwg have these dictionaries,

_$
((-1 . <Entity name: 7ef07c60>)
  (0 . "DICTIONARY")
  (330 . <Entity name: 0>)
  (5 . "C")
  (100 . "AcDbDictionary")
  (280 . 0)
  (281 . 1)
  (3 . "ACAD_CIP_PREVIOUS_PRODUCT_INFO")
  (350 . <Entity name: 7ef09690>)
  (3 . "ACAD_COLOR")
  (350 . <Entity name: 7ef095a0>)
  (3 . "ACAD_DETAILVIEWSTYLE")
  (350 . <Entity name: 7ef09670>)
  (3 . "ACAD_GROUP")
  (350 . <Entity name: 7ef07c68>)
  (3 . "ACAD_LAYOUT")
  (350 . <Entity name: 7ef07cd0>)
  (3 . "ACAD_MATERIAL")
  (350 . <Entity name: 7ef09410>)
  (3 . "ACAD_MLEADERSTYLE")
  (350 . <Entity name: 7ef09648>)
  (3 . "ACAD_MLINESTYLE")
  (350 . <Entity name: 7ef07cb8>)
  (3 . "ACAD_PLOTSETTINGS")
  (350 . <Entity name: 7ef07cc8>)
  (3 . "ACAD_PLOTSTYLENAME")
  (350 . <Entity name: 7ef07c70>)
  (3 . "ACAD_SCALELIST")
  (350 . <Entity name: 7ef095b8>)
  (3 . "ACAD_SECTIONVIEWSTYLE")
  (350 . <Entity name: 7ef09658>)
  (3 . "ACAD_TABLESTYLE")
  (350 . <Entity name: 7ef095a8>)
  (3 . "ACAD_VISUALSTYLE")
  (350 . <Entity name: 7ef094d8>)
  (3 . "AcDbVariableDictionary")
  (350 . <Entity name: 7ef07d80>)
  (3 . "AcDsDecomposeData")
  (350 . <Entity name: 7ef09880>)
)
_$

 

and the PHANTOM2 ltype, "should" be at the "ACAD_SECTIONVIEWSTYLE" dictionary, I say "should", because I couldn't find it at the dictionary, but if we delete the "ACAD_SECTIONVIEWSTYLE" dictionary, and then purge the dwg, the PHANTOM2 is purged.
Try to delete the dictionary and purge...
To delete the dictionary you can use something like this

(dictremove (namedobjdict) "ACAD_SECTIONVIEWSTYLE")

HTH
Henrique

EESignature

Tags (1)
Message 25 of 38
aqdam1978
in reply to: hmsilva

Hi Henrique,

 

I looked at to "ACAD_SECTIONVIEWSTYLE" and it has these items:

("ACAD_SECTIONVIEWSTYLE"
 (  (-1 . <Entity name: 7ffff705cb0>) (0 . "DICTIONARY") (5 . "1004B") 
   (102 . "{ACAD_REACTORS") (330 . <Entity name: 7ffff7038c0>) (102 . "}") 
   (330 . <Entity name: 7ffff7038c0>) (100 . "AcDbDictionary") (280 . 0) (281 . 1) 
   (3 . "Imperial24") (350 . <Entity name: 7ffff705cd0>)
 ) 
 (  "Imperial24" (-1 . <Entity name: 7ffff705cd0>) (0 . "ACDBSECTIONVIEWSTYLE") 
   (5 . "1004D") (102 . "{ACAD_REACTORS") (330 . <Entity name: 7ffff705cb0>) (102 . "}") 
   (330 . <Entity name: 7ffff705cb0>) (100 . "AcDbModelDocViewStyle") (70 . 0) 
   (3 . "Imperial24") (290 . 0) (100 . "AcDbSectionViewStyle") (70 . 0) (71 . 0) (90 . 78) (71 . 1) 
   (340 . <Entity name: 7ffff703910>) (62 . 256) (40 . 0.24) (340 . <Entity name: 0>) 
   (340 . <Entity name: 0>) (62 . 256) (40 . 0.24) (300 . "I, O, Q, S, X, Z") (40 . 0.48) (90 . 3) 
   (40 . 0.18) (90 . 1) (71 . 2) (340 . <Entity name: 7ffff705cc0>) (90 . 25) (62 . 256) 
   (340 . <Entity name: 7ffff703960>) (90 . 50) (62 . 256) (40 . 0.24) (40 . 0.0) (40 . 0.24) (71 . 3) 
   (340 . <Entity name: 7ffff703910>) (62 . 256) (40 . 0.24) (90 . 1) (40 . 0.75) (90 . 1) 
   (300 . "%<\\AcVar ViewType \\f \"%tc1\">% %<\\AcVar ViewSectionStartId>%-%<\\AcVar ViewSectionEndId>%\\PSCALE %<\\AcVar ViewScale \\f \"%sn\">%")
   (71 . 4) (62 . 256) (62 . 257) (300 . "ANSI31") (40 . 1.0) (90 . 0) (290 . 0) (290 . 0) (90 . 6) (40 . 0.0) (40 . 1.5708) (40 . 0.261799)
   (40 . 1.309) (40 . -0.261799) (40 . 1.8326)
 )
)

I tried your suggestion:

(dictremove (namedobjdict) "ACAD_SECTIONVIEWSTYLE")

After PURGE, the PHANTOM2 line type was disappeared!

YES, you solved this problem, but how this linetype defined in the "ACAD_SECTIONVIEWSTYLE" dictionary?

 

111111.png

 

Thanks,

Abbas

 

 

 

 

Message 26 of 38
mid-awe
in reply to: hmsilva

Marvelous solution! Much better than DXF round-trip conversion.
Message 27 of 38
hmsilva
in reply to: aqdam1978


@aqdam1978 wrote:
...

 but how this linetype defined in the "ACAD_SECTIONVIEWSTYLE" dictionary?

 

...


Abbas, as said before

 

"I say should, because I couldn't find it at the dictionary"

 

but when you have a little more free time, I'll try to find it...

 

Henrique

 

 

EESignature

Message 28 of 38
hmsilva
in reply to: mid-awe


@mid-awe wrote:
Marvelous solution! Much better than DXF round-trip conversion.

Thank you, mid-awe

 

Henrique

EESignature

Message 29 of 38
Lee_Mac
in reply to: aqdam1978


@aqdam1978 wrote:

...but how this linetype defined in the "ACAD_SECTIONVIEWSTYLE" dictionary?


The DXF data for the ACDBSECTIONVIEWSTYLE entity contained in the ACAD_SECTIONVIEWSTYLE dictionary has two entity name pointers to Text Styles and two entity names corresponding to Linetypes, these are highlighted below:

 

(
    (-1 . <Entity name: 7ef07668>)
    (0 . "ACDBSECTIONVIEWSTYLE")
    (5 . "1004D")
    (102 . "{ACAD_REACTORS")
    (330 . <Entity name: 7ef07658>) ;; Parent Entity
    (102 . "}")
    (330 . <Entity name: 7ef07658>) ;; Parent Entity
    (100 . "AcDbModelDocViewStyle")
    (70 . 0)
    (3 . "Imperial24")
    (290 . 0)
    (100 . "AcDbSectionViewStyle")
    (70 . 0)
    (71 . 0)
    (90 . 78)
    (71 . 1)
    (340 . <Entity name: 7ef04c88>) ;; Standard Text Style
    (62 . 256)
    (40 . 0.24)
    (340 . <Entity name: 0>) ;; Null
    (340 . <Entity name: 0>) ;; Null
    (62 . 256)
    (40 . 0.24)
    (300 . "I, O, Q, S, X, Z")
    (40 . 0.48)
    (90 . 3)
    (40 . 0.18)
    (90 . 1)
    (71 . 2)
    (340 . <Entity name: 7ef07660>) ;; PHANTOM2 Linetype
    (90 . 25)
    (62 . 256)
    (340 . <Entity name: 7ef04cb0>) ;; CONTINUOUS Linetype
    (90 . 50)
    (62 . 256)
    (40 . 0.24)
    (40 . 0.0)
    (40 . 0.24)
    (71 . 3)
    (340 . <Entity name: 7ef04c88>) ;; Standard Text Style
    (62 . 256)
    (40 . 0.24)
    (90 . 1)
    (40 . 0.75)
    (90 . 1)
    (300 . "%<\\AcVar ViewType \\f \"%tc1\">% %<\\AcVar ViewSectionStartId>%-%<\\AcVar ViewSectionEndId>%\\PSCALE %<\\AcVar ViewScale \\f \"%sn\">%")
    (71 . 4)
    (62 . 256)
    (62 . 257)
    (300 . "ANSI31")
    (40 . 1.0)
    (90 . 0)
    (290 . 0)
    (290 . 0)
    (90 . 6)
    (40 . 0.0)
    (40 . 1.5708)
    (40 . 0.261799)
    (40 . 1.309)
    (40 . -0.261799)
    (40 . 1.8326)
)

 

After perusing the ObjectARX documentation for the AcDbSectionViewStyle class, I would assert that the Text Style entity names correspond to the Identifier Text Style & View Label Text Style; and that the Linetype entity names correspond to the Bend Line Linetype & Plane Line Linetype.

 

Lee

Message 30 of 38
aqdam1978
in reply to: Lee_Mac

Hi Lee,

 

Thank you for  your help.

I have more than 500 drwaing that have this problem. (PHANTOM2 linetype),

as a conclusion, what should I do finally?

 

1. (dictremove (namedobjdict) "ACAD_SECTIONVIEWSTYLE")

2. Purge command

 

but I'm wondering if I apply the 1st step, in some drawing I may lose some entities or properties?

 

any idea will be apperciated....

 

Thanks,

Abbas

 

Message 31 of 38
Lee_Mac
in reply to: aqdam1978

The dictionary contents are controlled by the styles listed in the VIEWSECTIONSTYLE command; when modifying a Section View Style, you will find the linetypes for the bend lines & plane lines under the Cutting Plane tab.

 

However, since this command does not have a command-line version, I doubt it is possible to alter these settings through the command using a Script or AutoLISP program. I would think an automated solution to alter these settings would involve modifying the dictionary entries directly.

 

Deleting the parent dictionary (ACAD_SECTIONVIEWSTYLE) is not recommended, as the individual Section View Styles will still remain listed in the VIEWSECTIONSTYLE dialog, but will not appear in the Section View Style drop-down menu on the Layout tab of the Ribbon. However, when the drawing is closed and re-opened, the dictionary will be re-built automatically by AutoCAD and populated with a default Section View Style.

 

Lee

Message 32 of 38
aqdam1978
in reply to: Lee_Mac

Hi Lee,

 

Thanks for your helps,

 

I removed 

ACAD_SECTIONVIEWSTYLE

dictionary completely by:

(dictremove (namedobjdict) "ACAD_SECTIONVIEWSTYLE")

And then I purged drawing, so, PHANTOM2 linetype disappeared.

I saved the drawing, when I reopen it, AutoCAD recreat that dictioanry and PHANTOM2 is appeared again!

So, I think I should change the linetype property of "cutting plane lines" from PHANTOM2 to ByLayer.

But, How?, I don't know!

 

1.png

 

 

2.png

 

 

THANKS,

 

ABBAS

Message 33 of 38
Lee_Mac
in reply to: aqdam1978

Hi Abbas,

 

I think the PHANTOM2 linetype is the default linetype used when the Imperial24 Section View Style is automatically created by AutoCAD when MEASUREMENT=0 (when MEASUREMENT=1 the Metric50 Section View Style is created, which uses a CONTINUOUS linetype) - I doubt that these default linetypes can be altered.

 

However, to offer an alternative - instead of removing the ACAD_SECTIONVIEWSTYLE dictionary from the Named Object Dictionary, you could use the following code to set the Section View Style linetypes to ByLayer:

 

(defun c:secvstylelt ( / dic idx itm )
    (if (setq dic (cdr (assoc -1 (dictsearch (namedobjdict) "acad_sectionviewstyle"))))
        (while (setq itm (dictnext dic (null itm)))
            (setq idx 0)
            (entmod
                (mapcar
                    (function
                        (lambda ( x )
                            (if (and (= 340 (car x)) (< 3 (setq idx (1+ idx)) 6))
                                (cons 340 (tblobjname "ltype" "bylayer"))
                                x
                            )
                        )
                    )
                    itm
                )
            )
        )
    )
    (princ)
)

 

I hope this helps!

 

Lee

Message 34 of 38
hmsilva
in reply to: Lee_Mac


@Lee_Mac wrote:

...

However, to offer an alternative - instead of removing the ACAD_SECTIONVIEWSTYLE dictionary from the Named Object Dictionary, you could use the following code to set the Section View Style linetypes to ByLayer:

 ...


As usual, great thinking Lee!

The AC I have in this machine is too old and I can't access to ACDBSECTIONVIEWSTYLE entity, but I think that is the most correct solution...

 

Cheers

Henrique

EESignature

Message 35 of 38
Lee_Mac
in reply to: hmsilva

Thank you Henrique - hopefully it will be a viable solution for Abbas Smiley Happy

Message 36 of 38
aqdam1978
in reply to: Lee_Mac

Hi,

 

Thank you Lee,

Thank you Henrique,

Yes, your code is helpful for me:

 

;|
PHANTOM2 linetype is the default linetype used when the Imperial24 Section View Style
is automatically created by AutoCAD when MEASUREMENT=0 (when MEASUREMENT=1 the Metric50 
Section View Style is created, which uses a CONTINUOUS linetype)
instead of removing the ACAD_SECTIONVIEWSTYLE dictionary
from the Named Object Dictionary, you could use the following code to 
set the Section View Style linetypes to ByLayer:
|;
(defun c:PHANTOM2 ( / dic idx itm )
    (if (setq dic (cdr (assoc -1 (dictsearch (namedobjdict) "acad_sectionviewstyle"))))
        (while (setq itm (dictnext dic (null itm)))
            (setq idx 0)
            (entmod
                (mapcar
                    (function
                        (lambda ( x )
                            (if (and (= 340 (car x)) (< 3 (setq idx (1+ idx)) 6))
                                (cons 340 (tblobjname "ltype" "bylayer"))
                                x
                            )
                        )
                    )
                    itm
                )
            )
        )
    )
    (princ)
(command "_.PURGE" "a" "*" "n")
)

 

 

Thanks,

Abbas

 

 

 

Message 37 of 38
Anonymous
in reply to: aqdam1978

Dear Abbas,

I was facing the same problem today now i troubleshoot it. use the following steps hope it will work your problem too.

Steps:

First Use "Overkill" Command

Saveas .DXF (2007 format)

now open the .dxf  file and purge it and again save .dwg file

 

now your linetype will be by default ...

 

Regards

Nadim Abbas

Message 38 of 38
magliarig
in reply to: aqdam1978

To permanently remove UNUSED linetype PHANTOM2 in a drawing or template file enter the following command:

 

VIEWSECTIONSTYLE <enter>

Select MODIFY

Change PHANTOM2 linetype to BYLAYER

Click OK then CLOSE

Now remove or purge linetype PHANTOM2 from file

Save and relaunch file to see results...

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost