Disabel "scale lineweights" in model?

Disabel "scale lineweights" in model?

Micke_ELE
Contributor Contributor
2,219 Views
8 Replies
Message 1 of 9

Disabel "scale lineweights" in model?

Micke_ELE
Contributor
Contributor

Hello.

 

I have problems with drawings provided by a customer, probably converted to dwg.

 

Is there any way to disable "scale lineweights" in plot dialog when plotting Model?

Or a way to check what mode the drawing has.

 

Plot-dialog.png

 

It is not supposed to be enabled in model and when I batch plot my scripts don't work when some drawings ask the question "Scale lineweights with plot scale?"

 

Command log

Command: plot Detailed plot configuration? [Yes/No] <No>: Y
Enter a layout name or [?] <Model>: Enter an output device name or [?] <DWG To 
PDF.pc3>: dwg to pdf.pc3 Enter paper size or [?] <ISO full bleed A3 (420.00 x 
297.00 MM)>: ISO full bleed A3 (420.00 x 297.00 MM) Enter paper units 
[Inches/Millimeters] <Millimeters>: M Enter drawing orientation 
[Portrait/Landscape] <Landscape>: L Plot upside down? [Yes/No] <No>: N Enter 
plot area [Display/Extents/Layout/View/Window] <Window>: W Enter lower left 
corner of window <0.000000,0.000000>: none Enter upper right corner of window 
<31500.000000,22275.000000>: none Enter plot scale (Plotted Millimeters=Drawing 
Units) or [Fit] <1=75>: 0.013333333333333 Enter plot offset (x,y) or [Center] 
<Center>: CENTER Plot with plot styles? [Yes/No] <Yes>: y Enter plot style 
table name or [?] (enter . for none) <monochrome.ctb>: SVK monchrome.ctb Plot 
with lineweights? [Yes/No] <No>: Y Scale lineweights with plot scale? [Yes/No] 
<No>: A
Command: C:\PDF_OUT\E1234-1.PDF Unknown command "PDF".  Press F1 
for help.

Command: N Unknown command "N".  Press F1 for help.

Command: Y Unknown command "Y".  Press F1 for help.

 

/Micke

0 Likes
Accepted solutions (1)
2,220 Views
8 Replies
Replies (8)
Message 2 of 9

m_latz
Advisor
Advisor

Can you upload such a dwg file ?

 

Please delete confidential contents from the drawing.

 

regards

 

Markus

0 Likes
Message 3 of 9

Micke_ELE
Contributor
Contributor

I attach 2 files.

 

E1234-1.dwg (AC2010) and E1234-2.dwg (AC2013), both have "scale lineweights" enabled in Model.

 

I belived the name of model tab was the cause but then I foundout that E1234-2.dwg have the same trouble but the name is correct.

 

I used this to check the tab name

(vl-load-com)
(vla-get-name (vla-item (vlax-get-property (vla-get-activedocument (vlax-get-acad-object)) 'Layouts) 1))

 

E1234-1 returns "MODEL"

E1234-2 returns "Model"

 

/Micke

0 Likes
Message 4 of 9

m_latz
Advisor
Advisor
Accepted solution

Okay just checked the 2010 version (E1234-1.dwg)

 

In the Layout record of the ModelSpace entity is a bit flag set wrong:

 

Command: (entget (handent "53"))
((-1 . <Entity name: 7ffffb06b30>) (0 . "LAYOUT") (5 . "53") (102 .
"{ACAD_XDICTIONARY") (360 . <Entity name: 7ffffb0b300>) (102 . "}") (102 .
"{ACAD_REACTORS") (330 . <Entity name: 7ffffb06b10>) (102 . "}") (330 . <Entity
name: 7ffffb06b10>) (100 . "AcDbPlotSettings") (1 . "") (2 . "none_device") (4
. "ISO_A3_(420.00_x_297.00_MM)") (40 . 7.5) (41 . 20.0) (42 . 7.5) (43 . 20.0)
(44 . 420.0) (45 . 297.0) (46 . -7.5) (47 . -20.0) (48 . 0.0) (49 . 0.0) (140 .
420.0) (141 . 297.0) (142 . 1.0) (143 . 1.0) (70 . 2053) (72 . 1) (73 . 0) (74
. 4) (7 . "monochrome.ctb") (75 . 0) (147 . 1.0) (76 . 1) (77 . 2) (78 . 300)
(148 . 0.0) (149 . 0.0) (100 . "AcDbLayout") (1 . "MODEL") (70 . 1) (71 . 0)
(10 0.0 0.0 0.0) (11 12.0 9.0 0.0) (12 0.0 0.0 0.0) (14 -14.5542 -4.0 0.0) (15
31485.4 22271.0 0.0) (146 . 0.0) (13 0.0 0.0 0.0) (16 1.0 0.0 0.0) (17 0.0 1.0
0.0) (76 . 0) (330 . <Entity name: 7ffffb06980>) (331 . <Entity name:
7ffffb099a0>))

 

The group 70 Code (in your example 2053) is a "Plot layout flag". And Bit 10 (1024) is responsible for the Model Type. This is set wrong in your examples. Turn this bit off (2053-1024) then your plot dialog is correct. Or modify your program to check this setting here.

 

 

I hope it is clear, if not let me know.

 

To "decrypt" all settings for the LAYOUT object check the DXF reference manual from Autodesk. It can also be downloaded from their webpage.

 

regards

 

Markus

Message 5 of 9

Micke_ELE
Contributor
Contributor

Thank you.

 

Added following to my plot function

 

(vl-load-com)
(if (and (= "MODEL" (strcase (getvar "CTAB")))(= (vla-get-modeltype (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)))) :vlax-false))
 (progn
  (setq ed (entget (handent (vla-get-handle (vla-item (vlax-get-property (vla-get-activedocument (vlax-get-acad-object)) 'Layouts) 1)))))
  (setq ed (subst (cons 70 (- (cdr (assoc 70 ed)) 1024))(assoc 70 ed) ed))
  (entmod ed)
  (setq ed nil)
 )
)

Works grate now.

 

I really appreciate the help.

 

/Micke

0 Likes
Message 6 of 9

m_latz
Advisor
Advisor

Micke,

 

I made a "stupid" mistake. That it works is just for that special case.

 

Bit 11 (1024) must set to ON for ModelType ModelSpace. In our special case 2053 - 1024 = 1029 (= 1024 + 4 + 1)

 

But you have to check like this .... (you need to optimise for your program, just to explain)

 

(if (/= (logand (cdr (assoc 70 ed)) 1024) 1024)
  (setq (cons 70 (logior (cdr (assoc 70 ed))  1024)))

)

 

If the if statement is not true, Model Space is correct and you do not need to modify.

 

But your code could run into problems because if the groupcode 70 is less than 1024, your value gets negative !

 

I hope this is correct now, please test !

 

Tried to insert in your code snippet:

 

(vl-load-com)
(if (and (= "MODEL" (strcase (getvar "CTAB")))(= (vla-get-modeltype (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)))) :vlax-false))
 (progn
  (setq ed (entget (handent (vla-get-handle (vla-item (vlax-get-property (vla-get-activedocument (vlax-get-acad-object)) 'Layouts) 1)))))
  (if (/= (logand (cdr (assoc 70 ed)) 1024) 1024)
    (progn
      (setq ed (subst (cons 70 (logior (cdr (assoc 70 ed))  1024))(assoc 70 ed) ed))
      (entmod ed)
      (setq ed nil)
    ) ;-- end progn
  ) ;-- end if
 ) ;-- end progn
) ; -- end if

 

 

 

 

regards

 

Markus

 

 

0 Likes
Message 7 of 9

Micke_ELE
Contributor
Contributor

Markus,

 

My if statement check's if modeltype is :vlax-false, then groupcode 70 cannot be less then 1024 I belive?

 

/Micke

 

 

0 Likes
Message 8 of 9

m_latz
Advisor
Advisor

Sorry,

 

long time ago I wrote programs in Lisp and I never used the vlax functions.

 

regards

 

Markus

 

 

0 Likes
Message 9 of 9

Micke_ELE
Contributor
Contributor

Okay, thank you for taking the time to show me the solution of the problem.

 

Sincerely

 

/Micke

0 Likes