AutoCAD ARX function to get closed area around selected point - autocad-plugin

Deep in the abyss of my memory there is info that in AutoCAD API ObjectARX , there is function to get closed area arround known point but I don't remember name of this function. It works something simmilar to command _boundary, but not command which can be run by User interface, but clead ARX function .
Can anybody remember name of this function?

For ObjectARX/C++, it is acedTraceBoundary
In .NET, it is Editor.TraceBoundary

Related

Wrap "Open" VB6 function with custom function as drop in replacement

Question
Is there any way to write a custom function that uses the same pattern as the Open function? Including the fluff keywords like For and As?
Background
I am working on migrating an old VB6 project to use online data via an API, as a first step I'd like to replace all instances of
Open SomeFilename For Binary Access Read As #39
With a custom OpenOnline function
OpenOnline SomeFilename For Binary Access Read As #39
But I do not know how to indicate those keywords are necessary when creating a function, or even if it's possible to do so.
Function openOnline(FileName As String) [For] (Optional Access As AccessType = Binary Access) [As] (Optional FileNumber As Integer) As Boolean
' Do the work of connecting to the online data equivalent of FileName with that access type
End Function
Qualifiers
I understand that these keywords are nonsensical in the context of an OpenOnline function. I also understand that I can use regular expressions to find and replace the syntax to remove keywords like "For" and "Read".
There are hundreds of thousands of instances of this Open function, the Put and Get functions and a few other file related functions, I realize that long term the correct solution is changing the mechanisms fundamentally to use online paradigms, and that work is in progress- on schedule to be completed with about 4 months of effort at the rate things are going.
Bonus Question
Secondarily, is there any way for me to pass a "User Defined Type" variable to the new Put/Get replacements in a way that I can access their fields directly without knowing the type beforehand? (I understand that variants are only available for .cls classes or public user defined types in dlls, neither of which apply in this situation)
As for 1), you can get close but you can't exactly replicate the VB Open statement. Which means you won't get around of some search & replace passes for the current Open statement lines with your newly created one.
For 2), can you illustrate that with an example? I'm trying to think of a situation where you know the UDT member's name in advance, but not its type.
That said, perhaps looking at VB's VarType function gives you an idea for solving that.

Creating a new snip% with Racket

I am trying to create a new GUI element within DrRacket's text window, like picts or syntax objects. As far as I can tell, the most standard way of doing this is with a snip%.1
Unfortunately, the documentation for creating new snips, while comprehensive, is a bit impenetrable and leaves some questions to be answered.
For starters, what is the difference between a snip% and a snip-class%? Why do these need to be separated out into two classes, rather than simply being combined into one class? Is it because multiple snips will use one snip class?
Second off, what is snip-reader<%>? Not only why does it need to be a separate class, but why is the module providing it supposed to be installed?2 If it does need to be a new class, why can't it just be referred to directly. Why go through this whole process of constructing and then parsing a string of the form: "(lib ...)\n(lib ...)"?
I mean, there might now be any reason for this design, and it might just be a remnant of an old API. If so, has anyone thought of making a new more consistent API? Or if there is a reason for this design, can you please tell me what it is, as the docs don't seem to make that clear.
I mean, as of right now, I can copy/paste the sample given in the docs on creating a new snip. But I'm having a hard time understanding the design going on here, so I can use them properly.
1I know there are other ways to do it, but I also want to have interactive buttons and whatnot.
2I know it doesn't need to be installed as a library per se, but the documentation seems to strongly push you in that direction.
Okay, I think I finally found the answer. Broadly speaking:
The snip% class includes the methods for drawing the snip, telling the editor how much space to reserve for the picture, and handling events such as mouse clicks.
Next, the snip-class% class is used for encoding and decoding snips. This must be a separate class because when saved to a file, the editor needs to encode what type of snip it is, and for obvious reasons it can't just put the literal snip% class in there. The value it stores in the file is the snip-class%'s 'class name'. This can be anything, and as long as the editor has the classname associated to a snip-class%, it can be loaded. Additionally, if it is of the form "(lib ...)" or "(lib ...) (lib ...)" Racket will just automatically load it into the list for you.
Nothing 'needs' to be installed per se, its just the easiest way to go about it. Otherwise you manually need to tell the editor how to handle the snip before actually loading the file.

Unclear behavior DOS application's function

I'm trying to reverse some DOS application. It's uses *.VAR file like database (perhaps encoding this file). That's application looks like system for testing students. The application shows random questions from the DB-file and get your answer.
In this place programm read VAR-file length, then open the file and assign it to "newFilePtr_256_byte" var (yes, it's lenght 256 byte).
Next, going call of SUBJ FUNCTION (first screenshot).
After there is FileCounter check and do this call again (until all file would be read).
The function, i can't explain for, on second screenshot.
It's read a symbol from newFilePtr_256_byte and write it to console (nothing on console in real life working)?
Or it's do something else?
I can't recognize function behavior, coz i don't know, where i can get fully description Pascal functions in assembler listing.
I don't put in my question listing of caller function, coz it's really big.
As i can recognize, this function encode file content, by xoring with 0CDh constant, and then write it to buffer in memory.

Pass variable and its contents from workspace to GUI function in MATLAB

I have a variable in the MATLAB workspace and I want to pass the variable name and its contents to a function in my GUI.
How do I achieve this task?
I'm not totally sure what you mean when you say "pass the variable name and its contents", but here's one possible solution. After you pass a set of data to a function like so:
some_function(data); %# Pass the variable "data" to a function
You can get the variable name of the input argument from inside the function using INPUTNAME:
function some_function(inputArgument)
name = inputname(1); %# Will return "data" as the name of the input variable
end
EDIT: As pointed out in a comment by High Performance Mark, the variable inputArgument inside the function will contain the values stored in the variable data in the workspace of the caller.
If this question is related to your other most recent question, then why not build the operation into your GUI? You can use guide to create a pushbutton, and place the code under the callback function.
I am assuming that you have created the figure with GUI using the GUIDE, and that you know the 'Tag' names of the GUI objects.
((1)) Open the figure using the GUIDE, ((2)) Open the Property Inspector for the figure (select the background, the light-gray gridded area of the figure, and double-click over it, to make the Property Inspector for the figure to pop-up), ((3)) Turn the 'HandleVisibility' 'on' (by default, it may be set as 'callback'), ((4)) Save the figure and close the GUIDE, and finally ((5)) set the GUI property values from the MATLAB Console (or "Command Window") using some parameters that are currently available on your workspace.
I hope this helps.
Best,
Y.T.

capturing what keys were used to launch vbscript

I have an application that has 'macro' capabilities. When I map some keys on the keyboard to perform the 'macro', I can also have it launch vbscript instead.
What i'd like to try and do is within my vbscript figure out what keys were used in order to launch the script. Is it posible to do this? Could there be a way in vbscript to figure out what keys were last touched on the keyboard and then I could apply my logic.
The purpose of doing this is to keep the code in a single .vb file instead of several seperate .vb script files(one for each keyboard mapping, possible 3-4). Obviously we are looking to just maintain 1 file instead of multiple files with essentially the same code in each one.
I am leaning towards the idea that this is not possible, but i figured this would be a worthy question for the masses of StackOverflow. Thanks for the help everyone!
What you are asking for is not possible.
Can you change your VBScript to accept parameters and then call it with a different parameter based on which hotkey was selected?
I agree with aphoria, the only way to make something like this possible is if your keyboard mapping software allows you to assign a script/command with parameters/arguments. For example if you used
c:\Temp\something.vbs
then you would change this to
%WINDIR%\system32\wscript.exe c:\temp\something.vbs "Ctrl-Alt-R"
Then in your vbscript code you could collect the argument using the wscript.Arguments object collection to do actions based on what argument/parameter was passed. See the following two links for more info:
http://msdn.microsoft.com/en-us/library/z2b05k8s(VS.85).aspx
http://www.microsoft.com/technet/scriptcenter/resources/qanda/sept04/hey0915.mspx
The one possible approach you may use is to install keylogger and read its log in your VBScript.
For example save script start time in the very beginning of the script
StartTime = Timer()
and then read one log record of your keylogger before this time.

Resources