@Nikon
The "COND" statement will stop as soon as it meets the criteria for the square area range, so if something else meets the that area range before getting to your desired state, it will never get there. You will have to do a different comparison that is unique to the criteria. Maybe to change the criteria for the conditional statement to comparing the Length and width specifically, rather than with the area, or a combination of the area and the width, or something else, like a unique layer or color.
Maybe something like this instead (you can alter to suit the fudge factor for the viewport height and width):
(cond
((and (> 290.0 ViewPortHeight 300.0) (> 600.0 ViewPortWidth 650.0));; Compare the width and height directly!
(vla-put-ConfigName Layout "DWG To PDF.pc3")
(vla-put-CanonicalMediaName Layout "UserDefinedMetric (297.00 x 630.00мм)")
)
((and (> 290.0 ViewPortHeight 300.0) (> 835.0 ViewPortWidth 845.0))
(vla-put-ConfigName Layout "DWG To PDF.pc3")
(vla-put-CanonicalMediaName Layout "UserDefinedMetric (297.00 x 841.0мм)")
)
... ;; Repeat for all desired sizes
)
NOTE: You would also have to do both a landscape version and a Portrait version if you need both. Perhaps a bit more sophisticated comparison:
(cond
((or
(and (> 290.0 ViewPortHeight 300.0) (> 600.0 ViewPortWidth 650.0))
(and (> 290.0 ViewPortWidth 300.0) (> 600.0 ViewPortHeight 650.0))
)
(vla-put-ConfigName Layout "DWG To PDF.pc3")
(vla-put-CanonicalMediaName Layout "UserDefinedMetric (297.00 x 630.00мм)")
)
((or
(and (> 290.0 ViewPortHeight 300.0) (> 835.0 ViewPortWidth 845.0))
(and (> 290.0 ViewPortWidth 300.0) (> 835.0 ViewPortHeight 845.0))
)
(vla-put-ConfigName Layout "DWG To PDF.pc3")
(vla-put-CanonicalMediaName Layout "UserDefinedMetric (297.00 x 841.0мм)")
)
... ; Repeat for all desired sizes
(T (vla-put-ConfigName Layout "None")) ; Default to No plotter for non-standard sizes
)
NOTE: I can't test this directly without a "real world" sample drawing to compare, along with your pc3 file, so I'm trying to give you the knowledge to do it yourself, which is preferrable anyway.