Message 1 of 16
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
deleted as no one was interested!
Solved! Go to Solution.
deleted as no one was interested!
Solved! Go to Solution.
Try this first if it continues to not work then your missing the VL Arx file there is lots of comments about solving that problem.
(Defun c:strechvp ( / factor vps)
(vl-load-com)
or sorry!
the error message is not the same after I added the (vl-load-com).
the error became:
******************
Command: stretchvp
; error: bad argument type: VLA-OBJECT nil
******************
Thanks Sea-Haven!
or sorry!
the error message is not the same after I added the (vl-load-com).
the error became:
******************
Command: stretchvp
; error: bad argument type: VLA-OBJECT nil
******************
The thing is that if I just load the script to AutoCAD or C3D, it works perfectly.
The problem happens only when I use the "Autodesk Batch Save Utility" or "Accoreconsole.exe".
There is comments around about using VL with accoreconsole, simple terms does not work, but there is some comments about loading a ARX as part of accoreconsole use. Need to google I just use non VL.
Do a (entget (car (entsel "pick viewport"))) so can see the dxf code may help you to use entmod.
Hi Sea-Haven,
Thanks for pointing out this ARX related issues.
I just can't go that deep to use .crx since I need to take time to re-programming it.
I think I will go No VL way. The problem could be:
Since I am using accoreconsole to batch process many dwg's from time to time, I can't pick a viewport and then process it one by one. I need to let the lisp select all the viewports and then resize all the viewports by enlarging them by the factor of 1.105 from the each viewport center. and I think it's very hard to use non VL to achieve this.
Thanks for your help.
You can get ssget "VIEWPORTS" in a layout and walk through layouts so what is problem ?
The tiny code (entget (car (entsel))) allows you to pick a viewport and dump out all the dxf data resize and do again so see the values that change.
I use Notepad ++ so replace ") (" with ")\r(" makes all the values into a column, do it again after rescale to new file and notepad++ has a nice feature called "compare" so it compares the 2 files so you can see what has changed.
There is no problem getting viewports with ssget, you can step through all your layouts. Using dxf codes should be achievable, this is a Notepad++ comparing before and after a viewport. So 3 changes maybe, not tested using entmod.
a dump
; Property values :
;
; Application (RO) = #<VLA-OBJECT IAcadApplication 000000002B39EC30>
; ArcSmoothness = 1000
; Center = (397.413719364811 301.029963399289 0.0)
; Clipped (RO) = 0
; Color = 256
; CustomScale = 0.485444444670495
; Database (RO) = #<VLA-OBJECT IAcadDatabase 0000000064F716A8>
; Direction = (0.0 0.0 1721.xxx-xxxxxxxx)
; DisplayLocked = 0
; Document (RO) = #<VLA-OBJECT IAcadDocument 000000007170C648>
; EntityName (RO) = "AcDbViewport"
; EntityTransparency = "ByLayer"
; EntityType (RO) = NIL
; GridOn = 0
; Handle (RO) = "D995"
; HasExtensionDictionary (RO) = -1
; HasSheetView (RO) = NIL
; Height = 480.292580017251
; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0000000071626E38>
; LabelBlockId = NIL
; LabelBlockId32 = NIL
; Layer = "Vport"
; LayerPropertyOverrides (RO) = NIL
; LensLength = 50.0
; Linetype = "ByLayer"
; LinetypeScale = 1.0
; Lineweight = -1
; Material = "ByLayer"
; ModelView = NIL
; ObjectID (RO) = 1696120416
; ObjectID32 (RO) = 1696120416
; ObjectName (RO) = "AcDbViewport"
; OwnerID (RO) = 1696296096
; OwnerID32 (RO) = 1696296096
; PlotStyleName = "ByLayer"
; RemoveHiddenLines = 0
; ShadePlot = 0
; SheetView = NIL
; SnapBasePoint = (0.0 0.0)
; SnapOn = 0
; SnapRotationAngle = 0.0
; StandardScale = 1
; StandardScale2 = NIL
; StyleSheet = ""
; Target = (610.xxx-xxxxxxxx 453.508383716374 0.0)
; TrueColor = #<VLA-OBJECT IAcadAcCmColor 00000000239FF4A8>
; TwistAngle = 0.0
; UCSIconAtOrigin = -1
; UCSIconOn = -1
; UCSPerViewport = -1
; ViewportOn = -1
; Visible = -1
; VisualStyle = NIL
; Width = 787.928558531622
Hi Sea Haven,
I changed some codes to non vl, but I am stuck at: get the viewport center and scale the view port???
(defun c:Stretchvp ( / vps factor i e vpctr)
(initget 1)
(setq factor 1.015)
(if (setq vps (ssget "_X" '((0 . "VIEWPORT") (-4 . "/=") (69 . 1))))
(repeat (setq i (sslength vps))
(setq e (ssname vps (setq i (1- i))) data (entget e))
(setq cscale (getpropertyvalue e "CustomScale"))
(setq vpctr (cdr (assoc 10 (entget e)))) ; not working properly;;
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
(vlax-invoke e 'ScaleEntity (vlax-get e 'Center) factor)
(vla-put-CustomScale e cscale)
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
)
)
(princ)
)
???
I realized that vl is efficient and the non vl way is too hard for me to make them work.
But, thanks for your help and knowledgeable inputs.
I looked at the 3 values highlited 40, 41 & 45 you asked for 1.5% so if you do a (entget (car (entsel))) on your viewport and the resize using your program then entget again the values are 1.015 time different the center does not change. Just use ID and pick the corners to see co-ordinates. You will see the matching values. I checked with a calculator got 1.0499999999 etc
Google entmod method.
Hi Sea-Haven:
I almost give up on this enlarging viewports lisp.
I made a lot of efforts and sometimes, it worked but most of the time, I got error message when I run "Strechvp", like this:
"; error: bad argument type: stringp <Entity name: 29febb9ee80> "
lisp routine is below! and any help to be welcome!
#################################################
(defun c:Stretchvp ( / factor vps)
(initget 1)
(setq factor 1.015)
(setq vps (ssget "_X" '((0 . "Viewport") (-4 . "/=") (69 . 1))))
(repeat (sslength vps)
(setq vpname (ssname vps 0))
(setq vpdata (entget vpname))
(setq cscale (cdr (assoc 48 vpdata)))
(if cscale
(progn
(setq newcscale (* cscale factor))
(setq newvpdata (subst (cons 48 newcscale) (assoc 48 vpdata) vpdata))
(entmod newvpdata)
)
(alert (strcat "Viewport " vpname " does not have a scale factor."))
)
(setq entname (cdr (assoc 0 vpdata)))
(ssdel entname vps)
)
(princ)
)
Maybe this not tested as vps can have more than 1 viewport.
(repeat (sslength vps)
(setq vpname (ssname vps 0))
(repeat (setq x (sslength vps))
(setq vpname (ssname vps (setq x (1- x))))