SNIPE

Inject LDRAW script directly into a new LDCAD session

Recommended Posts

Hi,

I was wondering if it is possible to inject LDRAW script directly into a new LDCAD session (aka where there is no file created yet)

I know that you can copy and paste LDRAW script directly into an LDCAD window and it creates the digital assembly if the script is valid.

Ideally I would like to be able to click on a link in excel which contains a macro or a batch script which injects a corresponding chunk of LDRAW script into LDCAD.

And hopefully skip past the ldcads inro dialog box where it asks the user if you want to open a recent file/file from disk, or create  a new file.

Maybe @roland can shed some insight into this? LD view is another option  but I would prefer LDCAD.

The idea is that it would save me from creating thousands of files per chunk of ldraw script.

I tried doing in CMD: echo 1 0 0 0 0 1 0 0 0 1 0 0 0 2024.dat | LDCad.exe but nothing happned

and when I did echo 1 0 0 0 0 1 0 0 0 1 0 0 0 2024.dat > LDCad.exe it seems to have corrupted ldcad.exe so I gotta download it again (I get 'this app cant run on your PC')

Regards, Snipe

Share this post


Link to post
Share on other sites
2 hours ago, SNIPE said:

I was wondering if it is possible to inject LDRAW script directly into a new LDCAD session (aka where there is no file created yet)

Not exactly, but you can get close using a macro.

function runPasteReplace()
  ldc.action('editSes_selAll'):run()
  ldc.action('editSes_selDel'):run()
  ldc.action('editSes_editPaste'):run()
end
ldc.macro('Paste replace'):setEvent('run', 'runPasteReplace')

This will replace the current model with whatever is on the clipboard. Tested in 1.7 alpha, but should also work in 1.6.

Just put the above snipped in a new global lua file (ldcad restart needed), or append it to e.g the default misc.lua global script (will trigger reload) and assign a hotkey to it.

Now if you start a new model you can use it multiple times given your excel sheet puts stuff on the clipboard.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.