Proper snap setting to intersect a Draw Line to element when angle is locked?

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.

  • 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. 

  • 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:

    • MicroStation help, because the most of information is there already.
    • MicroStation wiki, where many useful articles can be found (e.g. this one).
    • As you wrote, existing discussions are also valuable sources of information.
    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:

    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.

    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.

    With regards,

      Jan

  • ok I think I have a work around 

    run the place line tool first   from the icon  or a F key etc with the keyin "place line", then tick the angle box and set your angle value into the box  ( you said you had lots times to use different angles.) .. then run this keyin 

    lv=PAVTBASE;lc=0;co=3;wt=2;E, PLACE LINE CONSTRAINED;%d;snap pointon

    then data point on the dot and  move the mouse near the end of the line and data point it will snap to point on via best fit solution to achieve the angle  if its not possible you will get a red X meaning no solution possible with the angle given.

    then reset to end the command

    you can the rerun the command  if you keyed it  in with the up arrow but if its in custom F key  just hit the F key but only if you want the same angle

     or set  the place line tool  in one F key and  set the other command in a Shift same F key

    alternative put Jan's full key in a F key and  edit the F key angle script   in the keyin every time you need to change the angle..

    Jan's solution is very good if you have a lot to do with the same angle.. but if you need to change the angle often  then do a whole bunch with the same angle my solution would work just as nicely but you have to give it the angle in a dialog box with the tick on to keep it active..

    My solution means you don't have to edit the keyin and this prevents user breaking it..

    However if your always going to use the same angle forever then put jans  keyin into a Custom F key and  go to town....

    A custom macro that you run and you could set the angle  or if no angle keyed in eg space bar would reuse the last angle set ( ie it remembers the angle used last time and use it instead) would be the ideal solution but if you do this often or a big enough project  then you should PAY a professional programmer to develop and build it for you .. it would be far more cost effective than trial and error while trying to learn vba on the fly... and you get to keep the vba as long as you want  to use it now and into the future... and your  unlikely to get anyone in the programming forum to do this for free as this is how they  make their living.. yes many have very generously published free tools but they are very generic to benefit the most users  like the custom Find replace text and many others  that Jon Summers has shared with us ... but in your case it  is just too specific to make it useful to many others ..  we would just do it by hand for one  or two times... in a lifetime ... 

    So a keyin we can cobble together is not something that will take a lot of a posters time  or is a bit of an intellectual challenge  was the best bet and  it paid off nicely  in Jans post and got me thinking to give you an other option to meet  your flexible situation...

    Cheers

    Lorys

    Started msnt work 1990 - Retired  Nov 2022 ( oh boy am I old )

    But was long time user V8iss10 (8.11.09.919) dabbler CE  update 16 (10.16.00.80) 

    MicroStation user since 1990 Melbourne Australia.
    click link to PM me