Thanks Kean for clearing that up. It always helps to know the reasons why.
Thanks Kean,
Sorry to interrupt your birthday holiday :evil:
Be well,
I wonder why ADesk did this? What would be the benefit in changing a file's extension? Is it due to some special new type of compiling? Even then what is wrong with keeping it as arx?
Anyway, I guess there's 2 ways to go about it:
- Redo your vlx and have a check for both "geomcal.arx" and "geamcal.crx"
- Copy the geomcal.crx into the same folder, then rename it to geamcal.arx, no need to update the vlx. NOT recommended from AutoDesk, please try your utmost to modify your code instead.
Please don't copy and rename: you should check for both extensions if you need to load them programmatically.
.crx is used to denote modules that can be loaded into AcCore - which you can access via the Core Console application in AutoCAD 2013 onwards - and over time I expect more modules to be built to work in this environment. Being able to run commands in a "headless" (GUI-free) AutoCAD is very valuable, so it's all being done with the best of intentions.
Here's some more info, in case: http://adndevblog.typepad.com/autocad/2012/11/developing-a-crx-app.html
Kean
The .arx modules link to the AutoCAD editor host (e.g. acad.exe); the .crx modules link to the core console (accore.dll). The separation allows core-specific stuff to work in any core host, while still enabling *all* the stuff when running inside an AutoCAD host.
Thank you, Irneb . I do it like following :Code - Auto/Visual Lisp: [Select]
Lee,
Your optional code is still questionable, result wise.
The reason is (arxload (findfile "geomcal.arx"))-->(arxload nil)
In AutoCAD 2015 , geomcal.arx Extension has been changed into ".crx"
My 2 cents:
< .. >
2) It's usually a bad idea to check whether the dependent module is already loaded instead of just going ahead and loading it, again for two reasons. One, there is very little performance benefit, and possibly even a net loss if the module usually is NOT loaded. Two, the act of calling (arxload) might be the mechanism that expresses a dependency on the module -- and if it is, then skipping the (arxload) could mean the module might be unloaded between the time it's status is checked and the time it is used. In fact, current versions of AutoCAD do not perform reference counting via (arxload), but there is such a mechanism under the hood that is used by ObjectARX apps, and it could very well be utilized in a future version of AutoCAD.There's one issue with this in AutoLisp. From the help on the arxload function:
Attempting to load an application that has previously been loaded results in an error. Before using arxload you should use the arx function to check the currently loaded applications.So the help documentation actually states that you must first check to see if the file has already been loaded. So the documentation actually contradicts this, should the documentation be ignored and no check be done?
You can omit the .arx extension from the file name.Is this a case of the documentation needing updating in that it should state the following?
You can omit the .arx or .crx extension from the file name.If so then to alleviate both possible issues it is extremely simple:
(or CAL (arxload "GEOMCAL"))That's a good idea to get around the possibly slow check through the arx list, it should be faster since it's using the symbol table instead of the list of strings. Not sure how AutoLisp implements this internally, but most languages use something faster than a serial list search - usually something like a hash table.
What's not clear though is if it searches for various known extensions to the file like the load function does. It appears so from the examples, but nowhere is it explicitly stated: ...Doing a bit more searching in the documentation ... even the 2015 docs say nothing about CRX. Only arx for windows and bundle for Mac: http://help.autodesk.com/view/ACD/2015/ENU/?guid=GUID-965A0D2A-CFD0-4D7C-9D2B-2D8188F0DAC8
My 2 cents:
1) The .crx should always be preferred (unless both .arx or .crx may exist, and the app utilizes additional functionality in the .arx when it is available). The reason is two-fold. First, code should usually be optimized for the most recent version of AutoCAD, since over a typical app's lifetime it will be running on the current or a later version of AutoCAD much more often than on older versions of AutoCAD. Second, it's best to minimize dependencies, and in the event both a .crx and an .arx are available (or will be in a future AutoCAD), choosing the .crx results in fewer dependencies.
2) It's usually a bad idea to check whether the dependent module is already loaded instead of just going ahead and loading it, again for two reasons. One, there is very little performance benefit, and possibly even a net loss if the module usually is NOT loaded. Two, the act of calling (arxload) might be the mechanism that expresses a dependency on the module -- and if it is, then skipping the (arxload) could mean the module might be unloaded between the time it's status is checked and the time it is used. In fact, current versions of AutoCAD do not perform reference counting via (arxload), but there is such a mechanism under the hood that is used by ObjectARX apps, and it could very well be utilized in a future version of AutoCAD.
( (lambda ( a b )
(or
(vl-some '(lambda (f) (member f a)) b)
(vl-some '(lambda (f) (and (findfile f) (arxload f nil))) b)
)
)
(mapcar 'strcase (arx))
'("GEOMCAL.CRX" "GEOMCAL.ARX")
)
( (lambda ( a b )
(or
(vl-some '(lambda (f) (member f a)) b)
(arxload "geomcal" nil)
)
)
(mapcar 'strcase (arx))
'("GEOMCAL.CRX" "GEOMCAL.ARX")
)
(defun _ArxLoad ( basename )
( (lambda ( a b x )
(or
(vl-some '(lambda (s) (member (strcat b "." s) a)) x)
(arxload b nil)
)
)
(arx)
(strcase (vl-filename-base basename) t) ;; ijit proofed
'("crx" "arx")
)
)
Almost: vl.crx can be in any "host" that uses AcCore (i.e. the Core Console or full AutoCAD), while vl.arx can only be used in AutoCAD.Thanks Kean .
Kean