Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Error: Automation Error. Cannot scale nonuniformly
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Error: Automation Error. Cannot scale nonuniformly (Read 1157 times)
0 Members and 1 Guest are viewing this topic.
damn
Mosquito
Posts: 15
Error: Automation Error. Cannot scale nonuniformly
«
on:
March 01, 2021, 02:04:15 AM »
I'm stumped on this error. In a new drawing session if I open Template "C" and run a layout generator routine I get this error. If I open Template "A" and rerun the routine it works. If Template "A" has been open at any stage during the session it will work. I've pinpointed down to a key viewport that is rezoomed on ea layout. I Haven't written the following code and whilst it mostly works well much of it is poorly documented. I've also pinpointed the code down to this line.
(vla-transformby obj mat)
I realise that's not much help. What possibly could opening another template introduce to prevent the error?
Code expanded.....
Code - Auto/Visual Lisp:
[Select]
(
foreach
obj
(
vlax-invoke
(
setq
doc
(
vla-get-activedocument
(
vlax-get-acad-object
)
)
)
'copyobjects
lst
(
vla-get-block
alay
)
)
;;; Code below crashes if Telstra template has not been opened
(
vla-transformby
obj mat
)
)
EDIT (John): Added code tags.
«
Last Edit: March 01, 2021, 03:11:49 PM by John Kaul (Se7en)
»
Logged
BIGAL
Swamp Rat
Posts: 1425
40 + years of using Autocad
Re: Error: Automation Error. Cannot scale nonuniformly
«
Reply #1 on:
March 01, 2021, 08:16:36 PM »
telstra your in AUS
To many unknowns you have 3 variables with no idea of values.
Explain what it is your trying to do.
Logged
A man who never made a mistake never made anything
damn
Mosquito
Posts: 15
Re: Error: Automation Error. Cannot scale nonuniformly
«
Reply #2 on:
March 02, 2021, 05:37:52 PM »
Hi Al, yeah I'm Aus. In short the code is part of a function creating layouts base on the number of frames in the drawing. I haven't tried to figure what this part of the code does as up till now it worked as I always used template A 1st. One of my colleagues discovered when they jumped straight into template C and at 1st I couldn't replicate their problem.
This part of the function zooms on the Key viewport in on the current frame relative to the created to layout and from what I can read it try to sort draw order. Code elaborated, sorry still poorly documented. I realise this probably won't help. I was hoping the scale nonuniformly was common bug.
Code - Auto/Visual Lisp:
[Select]
(
defun
_copyNTSnbn
(
ob vp lay
/
acobj acdoc aclay ascc
)
(
setq
acobj
(
vlax-get-acad-object
)
acdoc
(
vla-get-ActiveDocument
acobj
)
aclay
(
vla-get-layouts
acdoc
)
ascc
(
vla-get-selectionsets
acdoc
)
alay
(
vla-item
(
vla-get-layouts
acdoc
)
lay
)
)
(
vla-put-activelayout
acdoc
alay
)
(
setq
lst
(
list
ob
)
)
(
vla-put-mspace
acdoc
:vlax-true
)
(
vla-put-activepviewport
acdoc vp
)
(
setq
mat
(
vlax-tmatrix
(
append
(
mapcar
'
(
lambda
(
a b
)
(
append
(
mapcar
'
-
(
trans
(
trans
a
0
2
)
2
3
)
org
)
(
list
b
)
)
)
'
(
(
1.0
0.0
0.0
)
(
0.0
1.0
0.0
)
(
0.0
0.0
1.0
)
)
(
setq
org
(
trans
(
trans
'
(
0.0
0.0
0.0
)
0
2
)
2
3
)
)
)
'
(
(
0.0
0.0
0.0
1.0
)
)
)
)
)
(
foreach
obj
(
vlax-invoke
(
setq
doc
(
vla-get-activedocument
(
vlax-get-acad-object
)
)
)
'copyobjects
lst
(
vla-get-block
alay
)
)
;;; Code below crashes if Telstra template has not been opened
(
vla-transformby
obj mat
)
)
(
vla-put-mspace
acdoc
:vlax-false
)
(
setvar
"clayer"
layerNTSGRID
)
(
setq
new
(
ssget
"L"
)
)
(
if
(
setq
eName
(
ssname
new
0
)
)
(
progn
(
vla-getboundingbox
(
vlax
-
ename
->
vla-object
eName
)
'mn 'mx
)
(
vl-cmdf
"._rectang"
(
vlax
-
safearray
->
list
mn
)
(
vlax
-
safearray
->
list
mx
)
)
)
)
(
entdel
eName
)
(
setq
pline
(
vlax
-
ename
->
vla-object
(
ssname
(
ssget
"L"
)
0
)
)
)
(
setq
outerLoop
(
vlax
-
make
-
safearray
vlax-vbObject
'
(
0
.
0
)
)
)
(
vlax
-
safearray-put-element
outerLoop
0
pline
)
(
setq
hatch
(
vla-AddHatch
(
vla-get-block
alay
)
acHatchPatternTypePreDefined
"ANSI31"
:vlax-True
)
)
(
vla-appendouterloop
hatch outerLoop
)
(
vla-put-color
hatch acMagenta
)
(
vla-evaluate
hatch
)
(
vla-delete
pline
)
)
EDIT (John): Added code tags.
«
Last Edit: March 02, 2021, 05:46:34 PM by John Kaul (Se7en)
»
Logged
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Error: Automation Error. Cannot scale nonuniformly