Author Topic: AutoLISP with Microstation  (Read 9565 times)

0 Members and 1 Guest are viewing this topic.

Coder

  • Swamp Rat
  • Posts: 827
AutoLISP with Microstation
« on: April 03, 2021, 05:52:05 AM »
Hello everyone.

The company that I work for will start using MicroStation program and I might be one of the others who would use this software.

I've read a few threads on the internet is that MicroStation does not run or use AutoLISP routines but I am still can't confirm this.

Is there a way to run Lisp routine in MicroStation or any work around this big obstacle?

Thank you in advance.

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: AutoLISP with Microstation
« Reply #1 on: April 03, 2021, 09:09:46 AM »
Never used Microstation, but at first glance looks like it supports VBA as a development language, which is something.
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

Coder

  • Swamp Rat
  • Posts: 827
Re: AutoLISP with Microstation
« Reply #2 on: April 03, 2021, 09:14:08 AM »
Thank you for your reply.

I need to be able to use AutoLISP or convert Lisp routines into any other language that can be used in MicroStation.
I don't know anything about VBA.

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: AutoLISP with Microstation
« Reply #3 on: April 03, 2021, 01:56:39 PM »
I need to be able to use AutoLISP or convert Lisp routines into any other language that can be used in MicroStation.

I don't think you would be able to use AutoLISP directly for MicroStation, so you'll have to 'convert' them into other language which is supported by MS.
Conversion is not the most accurate verb, rather its to 'translate' the algorithm of the LISP routine to be used in another (similar) API.


I don't know anything about VBA.

Its the first thing I check, which would mean that it supports COM, so you could use LISP from ACAD to instantise MS object and create new Document and manipulate stuff via properties'n'methods - sample pseudocode:
Code: [Select]
; NOTE: its a sample pseudocode, it should not work if you copy-paste
(setq MSapp (vlax-get-or-create-object "Bentley.Interop.MicroStationDGN.Application"))
(vlax-invoke-method MSapp 'Show :vlax-true)
(setq MSdoc (vlax-invoke-method MSapp 'AddDocument "Sample document"))

But this LISP'ing approach is only "ODBX-like", meaning that it would be only suitable for automating tasks for like 50 MS projects in a row,
and not for creating new custom commands for to be invoked by the user while working in MS.

MicroStation Development Languages
Looks like they support C# aswell.

(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

Coder

  • Swamp Rat
  • Posts: 827
Re: AutoLISP with Microstation
« Reply #4 on: April 03, 2021, 03:06:36 PM »
Thank you for your kind explanation, that helps a lot.

BIGAL

  • Swamp Rat
  • Posts: 1392
  • 40 + years of using Autocad
Re: AutoLISP with Microstation
« Reply #5 on: April 03, 2021, 07:22:09 PM »
Years ago looked at Microstation and using MDL, its a C programming language structure so can see why a lot of people never write anything.

I would go down the VBA way if your use to VL commands.

I had a lisp2c converter years ago it sort of fell off the planet may still be out there. The issue is it may be even 16bit code so need a old pc to run it on.

re 2001 forum comment

A few years back when AD introduced "C" and ARX there were two product
that were put on the market to convert lisp to "C"

One from Slovinia L2C (I think) and ours drc_yak. from drcauto.com
the Guys that brought you LT toolkit (+lisp for LT). Gary D'arcy
« Last Edit: April 03, 2021, 07:27:20 PM by BIGAL »
A man who never made a mistake never made anything

wizman

  • Bull Frog
  • Posts: 290
Re: AutoLISP with Microstation
« Reply #6 on: April 04, 2021, 05:04:37 AM »
Back in V8i days, the commonly used lisp routines are built-in commands already in Microstation, you just have to find the tool.  You may start with recording macros since it is the easiest way to script and as well as using a series of key-ins is the way to go to automate tasks.  MDL's, i believe, are the more advanced programming packages.  But I'm not sure if these are all available in the newer versions of Microstation.

Coder

  • Swamp Rat
  • Posts: 827
Re: AutoLISP with Microstation
« Reply #7 on: April 04, 2021, 07:16:53 AM »
Back in V8i days, the commonly used lisp routines are built-in commands already in Microstation, you just have to find the tool.  You may start with recording macros since it is the easiest way to script and as well as using a series of key-ins is the way to go to automate tasks.  MDL's, i believe, are the more advanced programming packages.  But I'm not sure if these are all available in the newer versions of Microstation.

Thank you for your kind reply.

Are you indicating to .scr file when you said 'the easiest way to script' ?

Even macros and scripts are not enough to do coding

wizman

  • Bull Frog
  • Posts: 290
Re: AutoLISP with Microstation
« Reply #8 on: April 04, 2021, 07:24:31 AM »
Back in V8i days, the commonly used lisp routines are built-in commands already in Microstation, you just have to find the tool.  You may start with recording macros since it is the easiest way to script and as well as using a series of key-ins is the way to go to automate tasks.  MDL's, i believe, are the more advanced programming packages.  But I'm not sure if these are all available in the newer versions of Microstation.

Thank you for your kind reply.

Are you indicating to .scr file when you said 'the easiest way to script' ?

Even macros and scripts are not enough to do coding

From I my recollection,  Scr files equivalent can be .txt file in MS.  Recorded macros are in .Mvba format. Then you can further dive into vba once you get the basics commands coming from recorded macros.

Coder

  • Swamp Rat
  • Posts: 827
Re: AutoLISP with Microstation
« Reply #9 on: April 04, 2021, 07:34:47 AM »
Will it be difficult to run the lisp routine in AutoCAD then convert the drawing into MicroStation and vice versa ?

wizman

  • Bull Frog
  • Posts: 290
Re: AutoLISP with Microstation
« Reply #10 on: April 04, 2021, 11:34:27 AM »
Will it be difficult to run the lisp routine in AutoCAD then convert the drawing into MicroStation and vice versa ?

Doable also but beware also that there are alot of mappings involved i.e. layers on/off, linetype, etc.

That can be your initial workflow while you are getting used to a totally different way of doing CAD.

But once you are familiar with MS, you don't want to switch back and forth between two programs.

There is a steep learning curve since it is not as user friendly but eventually you will find MS as a powerful & quick as AutoCAD can be.

One notable workflow difference between the two is that MS borders (titleblocks) are in modelspace. usually rotated, and usually not fixed at 0,0 origin.  So that is one thing you have to consider when you are switching between AutoCAD and Microstation.

Coder

  • Swamp Rat
  • Posts: 827
Re: AutoLISP with Microstation
« Reply #11 on: April 04, 2021, 12:10:52 PM »
Thank you so much for your important inputs.

Sorry to bother you again and hopefully this should be my last question.

I am planning to convert the drawings to CAD from MS to run my Lisp routines when needed then convert it back to MS, so will it be possible to lose objects on conversion between MS & CAD ?

wizman

  • Bull Frog
  • Posts: 290
Re: AutoLISP with Microstation
« Reply #12 on: April 04, 2021, 12:40:00 PM »
Sure thing!

V8i vs AutoCAD 20xx is very much possible to lose entities since at the time of developing MS, the newer AutoCAD objects are not yet recognized by MS like fields, multiview-blocks, dynamic blocks, tables, multi-leaders, wipeouts within blocks and others.
I recall draworders of wipeouts within blocks get messed up from MS to ACAD.

Be aware also that the first few linetypes in MS are specific only for MS and not available in AutoCAD.

Connect edition should have recognized these newer objects. Just make sure you have the proper enablers. 

MS is at first slow since it is tool based but the trick is to assign them as function keys.

My custom keyboard shortcuts in AutoCAD are numerical. I had them assigned to the Function key equivalents so there is no effort in switching between the two software. 

Coder

  • Swamp Rat
  • Posts: 827
Re: AutoLISP with Microstation
« Reply #13 on: April 04, 2021, 01:59:12 PM »
Be aware also that the first few linetypes in MS are specific only for MS and not available in AutoCAD.

I have not been involved into MS yet but I used to receive drawings converted from MS to AutoCAD and the Linetypes still available in AutoCAD and usually there used to be many when I drop down the Linetype control list.

Connect edition should have recognized these newer objects. Just make sure you have the proper enablers. 

Yes, this supports my above explanation in a way or another.

MS is at first slow since it is tool based but the trick is to assign them as function keys.

My custom keyboard shortcuts in AutoCAD are numerical. I had them assigned to the Function key equivalents so there is no effort in switching between the two software. 

Sorry I did not get your point here.

Thank you.

Coder

  • Swamp Rat
  • Posts: 827
Re: AutoLISP with Microstation
« Reply #14 on: April 04, 2021, 02:34:23 PM »
First Step?> ...................

Can you please leave this thread academic and stop messing up with threads in this forum including this one with your useless replies ?