I have a repetitive task where I must draw a line from a point at an angle and intersect another line. I've automated a few of the steps with keyins to activate the line tool at the correct angle whereby I can draw the line outwards and then intersect another line. I'm trying to do this with one click of the icon that runs the keyins, but there doesn't appear to be a snap setting that will allow me to tie to a line. This adds another step as I usually just end the line near where it should intersect and use the "Trim to Element" tool to connect. I have to do this a lot, so any reduction in steps helps to speed the process. Any help would be greatly appreciated.
Assuming the angle is a known value, this is how I would do it:
I prefer this over the NEAREST snap option as I don't have to continuously enter the angle over and over into the accudraw.
So, the video you posted describes exactly what I am trying to do, but I'd like to do it from a keyin which I have set to a customized tool. Basically what I want to do is activate the tool which will do the following:
1. Set symbology, active angle, and change snap temporarily to keypoint.
2. Activate the place line at angle tool.
3. Get user to place an initial datapoint (using keypoint snap) to begin the line.
4. Snap then changes to temporarily PointOn so that I can extend the line along the angle and perfectly tie-in to another line.
5. Preferably to return snap to what was active before tool was activated.
Here's my key-in code:
AA=206.6; lv=PAVTBASE;lc=0;co=3;wt=2; snap keypoint; E, PLACE LINE ANGLE; %d;
I'm not an expert with coding keyins, but as I understand it, %d waits for the user to input a datapoint. I've tried placing the SNAP POINTON keyin in various places but the result is either the PointOn snap is greyed out or the PointOn snap is activated but shifts along the targeted line as opposed to tying in at the intersection.
Thanks to all the replies thus far.
Also, I'm using PowerGeopak V8i (SS10), 08.11.09.0918
Hi Bryan,
Bryan the Designer said:but I'd like to do it from a keyin which I have set to a customized tool.
such request is "on edge" of key-ins potential and standard feature. It can be done, but in my opinion such solution is fragile and VBA macro allows to implemented more robust solution.
Bryan the Designer said:Basically what I want to do is activate the tool which will do the following:
You have to be very careful about a sequence of steps, because data point often change "something".
Bryan the Designer said:Here's my key-in code:
There are several issues in my opinion:
My version of the sequence is:
All together:
lv=PAVTBASE;lc=0;co=3;wt=2;E, PLACE LINE CONSTRAINED;set item toolsettings angletoggle=1;set item toolsettings angle=206.6;%d;snap pointon
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Answer Verified By: Bryan the Designer
That works!!! Thank you so much. You're awesome. I do enjoy playing around with keyins but haven't found much on the web by way of learning how to put them together other than the very helpful posts found here. Are there any references you recommend for keyins and VBA macro coding? Thanks to the other responses too.
Wait, there is one hitch. I have several sets of these tools to run the same keyin but with different angles. After using the keyin at one angle and then trying to use another set at a different angle, it wants to keep the angle from the previous tool. Is there anyway to turn the angle toggle off after the 2nd datapoint (to end the line). Thanks.
Bryan the Designer said:but haven't found much on the web by way of learning how to put them together other than the very helpful posts found here
As far as I know, there is not anything specialized to key-ins. In fact, there are "just key-ins" and the most of the magic is to know, how individual key-ins work. Useful sources are:
Bryan the Designer said:Are there any references you recommend for keyins and VBA macro coding?
To learn MicroStation VBA, you have to learn VBA itself at first, which is not typically covered in MicroStation-related documents.
Useful sources about VBA:
Bryan the Designer said:Is there anyway to turn the angle toggle off after the 2nd datapoint (to end the line).
Extend the key-in by yourself. When you understand what current version does, every single piece of it, you should be able to modify the key-in without any problem.
Bryan the Designer said:it wants to keep the angle from the previous tool.
Your approach is wrong (in a meaning "cannot be robust enough"). Even when it's generally recommended, that every tool should do some "clean up", when it's finished, it's not possible ensure when only key-ins are used (and they are merged into key-ins chains). A reason is simple: When the key-in chain is interrupted in a middle, the rest of key-ins is forgotten.
Because of that, more important is that every tool, regardless implemented using key-in (and key-in chains) or some from MicroStation APIs (like VBA), always must ensure it sets everything as required itself. So, the solution is not to change existing key-in to switch the toggle off (even when it's good idea and recommended generally), but to ensure all other tools will switch on/off what required explicitly.
When MicroStation VBA (or any other MicroStation API) is used to implement own tool, the situation is simpler, because there is a mechanism, that is called when the tool is terminated (because e.g. another tool is started).
What can make situation a bit simpler is to use Element Templates, because every template can define plenty of detail MicroStation settings. So instead of creating loooong key-ins chains with hardly-to-maintain settings, to activate specific template before, the tool is stated, is enough.