Recommended Posts

Just now, MReizinho said:

Models built with LDCad are standard LDraw models. You'll have no problem with POV-Ray

Ok, thanks. I asked because I have a number of LDD .lxf files that I wanna try & translate to this as well.

Share this post


Link to post
Share on other sites
3 hours ago, MReizinho said:

There's something that has been nagging me for some time: part 24246.dat - Tile 1 x 1 with Rounded End, has some problems rendering correctly. You can notice a distinct shadow in the top surface that will change orientation as you rotate the model around. 

Does anyone know why this happens or if there is any way to avoid this? 

@roland, do you have any "hidden" parameters accesible through the config files to tune up the OpenGL rendering (outline lines, primitive substitution, light, etc.)?

It seems the smoothing algorithm trips on something, probably those very narrow triangle shaped rounded edges. I'll have to dive deeper in the part's construction to be able to improve on it.

The main problem is LDraw files have no 'normals' so LDCad has to invent them while loading the parts. This depends on certain assumptions and part construction parameters (especially the edges).

All LDraw related OpenGL options are found in the prefs/ldraw menu, the generic OpenGL options are in prefs/openGL

3 hours ago, Jason C. Hand said:

I'm gonna try out this software this weekend. Just curious, though: Can any models built with LDCad be made POV-Ray compatible?

As of version 1.6 LDCad also has it's own POV-Ray export feature, and if you want extreme HQ you can open the made LDR/MPD model in LDView to export while using the LGEO library.

Share this post


Link to post
Share on other sites

Hi, first of all thank you for the Great Tool.

I am also often get lxf Files(LDD). I Translate it with lxf2ldr, bedaure it uses the subgroups as submodules. Than I trying to add steps by disassembling the model backwards. And here is my question or suggestion. 
It would be helpful if there were an "insertAfter step " function that would insert an new empty step after the current step without leaving the current step. 
Then there should be a "Move selection to Next Step" function, which inserts the parts in reverse order as selected.
Of course, it would be even better if there were a disassemble mode, which would move each clicked part to the first position of the next step. 
Do you think, this could be possible?

Dirk

Edited by Neuenk
Typo

Share this post


Link to post
Share on other sites
8 hours ago, Neuenk said:

Hi, first of all thank you for the Great Tool.

I am also often get lxf Files(LDD). I Translate it with lxf2ldr, bedaure it uses the subgroups as submodules. Than I trying to add steps by disassembling the model backwards. And here is my question or suggestion. 
It would be helpful if there were an "insertAfter step " function that would insert an new empty step after the current step without leaving the current step. 
Then there should be a "Move selection to Next Step" function, which inserts the parts in reverse order as selected.
Of course, it would be even better if there were a disassemble mode, which would move each clicked part to the first position of the next step. 
Do you think, this could be possible?

Dirk

Maybe not exactly what you're looking for, but it's what I personally think works the easiest: open a new 'source window' by going to View -> New source window. In the source window you can arrange parts and steps in any order you like just using drag&drop functionality. :classic:

Share this post


Link to post
Share on other sites

Thanks for reply, but if you have a long list of parts, than it is a lot of scrolling, do drop to the right step.

Currently I have open the stepLIst, the source window and the reorganizing move step. Than I select the parts and click on the step after higlighted in the moving step window.

I like it, if i move a part, that it wil be move away, without hidding, because I am in the Step before. If a than use a new Step, I click in the step Window to next Step (or by keboard), click Insert and go to the previous Step.

It is only a wish, and I think the both function are more or less trivial to programming (I currently try to understand the lua api, than I can make these function by myself, but without debugging and understanding the full api, it is a little bit hard...)

Share this post


Link to post
Share on other sites
4 hours ago, Neuenk said:

Thanks for reply, but if you have a long list of parts, than it is a lot of scrolling, do drop to the right step.

Currently I have open the stepLIst, the source window and the reorganizing move step. Than I select the parts and click on the step after higlighted in the moving step window.

I like it, if i move a part, that it wil be move away, without hidding, because I am in the Step before. If a than use a new Step, I click in the step Window to next Step (or by keboard), click Insert and go to the previous Step.

It is only a wish, and I think the both function are more or less trivial to programming (I currently try to understand the lua api, than I can make these function by myself, but without debugging and understanding the full api, it is a little bit hard...)

You can open multiple source windows if you need to move multiple things from the bottom to elsewhere. Be sure to disable 'follow current step' and 'follow selection' for both windows (right click inside source win).

 

As for scripting, I think you want something like this (not extensively tested though),

Add it to "%appdata%/LDCad/scripts/default/global/steps.lua"  above the register function

function runSelInsStep() 

  --only useful if a model is active.
  local sf=ldc.subfile()
  if not sf:isLinked() then
    ldc.dialog.runMessage('No active model.')
    return
  end
  
  local ses=ldc.session()
  local sel=ses:getSelection()
  if sel:getRefCount()>0 then
    local curStep=ses:getCurStepNr()
    local idx=sf:getStepLineInfo(curStep+1)
    
    sf:addNewLine(idx, '0 STEP')
    for i=1,sel:getRefCount() do
      sf:moveLine(sel:getRef(i), idx)
    end
    
    ses:setCurStepNr(curStep)
  end
end

And add

  macro:register('Move selection to new step')
  macro:setHint('This will move the selection to a new step after the current one.')
  macro:setEvent('run', 'runSelInsStep')  

To its register function

Sorry for the lack of (>=1.6) API documentation it is still on my to do list :)

edit: This script won't work for the last step, I made a improvement for this but that version won't work in 1.6a due to a bug in moveLine. You can workaround it by adding a empty step to the model. You can remove it again when working with steps other then the last one.

Edited by roland

Share this post


Link to post
Share on other sites
--Insert selected Steps into Step after current Step  =============================================================================================================
function insertSelectionIntoNextStep(createNewStep) 

  --only useful if a model is active.
  local sf=ldc.subfile()
  if not sf:isLinked() then
    ldc.dialog.runMessage('No active model.')
    return
  end

  local ses=ldc.session()
  local sel=ses:getSelection()
  local refCnt = sel:getRefCount()

  if refCnt>0 then
    local curStep=ses:getCurStepNr()
    local idxCurStep=sf:getStepLineInfo(curStep)
    local idxNewStep
    local addNewStep= createNewStep == true

    if (sf:getStepCount() > curStep) then
      idxNewStep=sf:getStepLineInfo(curStep+1)
        local lineCnt=sf:getLineCount()
        if ( idxNewStep == 0) then 
        --print('nextStep has no items, we use nextStep for insert')
        addNewStep= false

        if (idxCurStep > 0) then
          --print('curStep has items, so search for curStep Line...')
          idxNewStep= idxCurStep
          repeat
              idxNewStep= idxNewStep+1
          until sf:getLine(idxNewStep):isStepMeta() 
          idxNewStep= idxNewStep+1
        else
          --print('curStep has also no items, search for curStep line ...')
          local steps= curStep
          repeat
              idxNewStep= idxNewStep+1
              if sf:getLine(idxNewStep):isStepMeta() then
                steps= steps -1
              end
          until idxNewStep>=lineCnt or steps== 0 
          if (idxNewStep>=lineCnt) then
            --print('curStep Line not found')
          --else
            --print('curStep Line found: '..idxNewStep)
          end
        end
      elseif (sf:getLine(idxNewStep):isStepMeta()) then
        --print('nextStep is last step without items, than we get directly the STEP line and use this for insert')
        addNewStep=false
        idxNewStep= idxNewStep + 1
      else
        --print('nextStep has items..'..idxNewStep)
        if (createNewStep) then
          idxNewStep= idxNewStep - 1
          if (idxCurStep == 0) then
            --print('curStep has no items, we use curStep for insert')
            addNewStep=false
          --else
            --print('curStep has items')
          end
        else
          --print('search for last position..')
          repeat
            idxNewStep= idxNewStep+1
          until idxNewStep>lineCnt or sf:getLine(idxNewStep):isStepMeta() 
        end 
      end
    else
      --print('current Step is last Step')
      if (not createNewStep) then 
        return
      end
      idxNewStep= sf:getLineCount() + 1
      if (sf:getLine(idxCurStep):isStepMeta()) then
        --print('curStep has no items, but at last step we get directly the STEP line; use curStep for insert')
        addNewStep=false     
      --else
        --print('curStep has items')
      end
    end

    --collect all selectect Items, because on moving the selection object will be damaged    
    local refList= {}
    for i=1,refCnt do
      local ref= sel:getRef(i)
      refList[i]= {}
      refList[i].ref= sel:getRef(i)
      refList[i].correctIdx= ref:getLineIndex() < idxNewStep
    end

    local useHelpLine
    if (idxNewStep > sf:getLineCount()) then
      useHelpLine= idxNewStep
      sf:addNewLine(idxNewStep, 'temporary helpline for tail-insert')
    end

    for i=1,refCnt do
      sf:moveLine(refList[i].ref, idxNewStep)
      if refList[i].correctIdx then
        idxNewStep= idxNewStep-1
      end
    end    
    
    if (useHelpLine) then
      sf:deleteLine(useHelpLine)
    end

    if (addNewStep) then
      sf:addNewLine(idxNewStep, '0 STEP')
      ses:setCurStepNr(curStep)
    end
  end
end

--Insert selected Steps into a new Step after current step =============================================================================================================
function runSelInsStep() 
  insertSelectionIntoNextStep(true)
end

--Insert selected Steps into next Step after current step =============================================================================================================
function runSelInsNextStep() 
  insertSelectionIntoNextStep(false)
end
  macro:register('Move selection to new step')
  macro:setHint('This will move the selection to a new step after the current one.')
  macro:setEvent('run', 'runSelInsStep')    

  macro:register('Move selection to next step')
  macro:setHint('This will move the selection to the next step after the current one.')
  macro:setEvent('run', 'runSelInsNextStep') 

 

Edited by Neuenk
splitted into 2 functions

Share this post


Link to post
Share on other sites
On 12/31/2017 at 1:08 PM, Neuenk said:

..big script...

There are still some situations that won't work (e.g. if the current step is the last one and has no items nor a step meta (getStepLineInfo returns 0)

Also it seems the wrong line is deleted when deleting the helper line because of the index shift caused by the new lines.

I'll make some improvements to the api to handle this kind of scenario much cleaner/shorter. It will be available in 1.6b which I'm hoping to release this month.

If anyone has some additional ideas for a practical script please let me know so I can test if it's possible using the current api etc and/or extend it if needed.

Edited by roland

Share this post


Link to post
Share on other sites

Hi Roland,

On editing my Post above, I also removed some  hints Form me above the Code... so before I didn't start directly with code, sorry.

There I descripe also the Situation Edith the getSteplineinfo and that has to be confused me..., with result 0 and that the last line Works in an other way.

I wrote also, that I Read your editing with the bug to Late and that  I had implement a Workaround.(helperline).

And this one I can fully understand:

On 30.12.2017 at 8:32 PM, roland said:

Sorry for the lack of (>=1.6) API documentation it is still on my to do list :)

And than I ask you, if you can apply this Script to your Next Version. But if you  have changed your API, I can also improve my Script.

22 hours ago, roland said:

I'll make some improvements to the api to handle this kind of scenario much cleaner/shorter. It will be available in 1.6b which I'm hoping to release this month.

Nice to Read this, you make a great job, thank you

Dirk 

Edited by Neuenk

Share this post


Link to post
Share on other sites
11 hours ago, Neuenk said:

And than I ask you, if you can apply thus Script to your Next Version. But if you  habe changed Sour API, I can also improve my Script.

Yes, you'll probably only have to check the moveLine usage as that function has a big problem in 1.6a (It uses an incorrect index conversion, needed because the internals never really delete lines. Deleted lines are then only hidden for undo purposes so a move is really a del+add opp)

 

Share this post


Link to post
Share on other sites

Ok, if I have installed the next version, I will check and test it.

Edited by Neuenk

Share this post


Link to post
Share on other sites

Afrer a long time using stud.io I have decided to take step forward and use LDCad as my main tool. There are however two things that bugs me a lot:

1) Is it possible to map camera movement to mouse wheel button i.o. propertiers?

2) Is it possible to create folders in favourite parts bin, preferable with fixed parts colors? it is extremly tedious to look for the parts, esp. when they have different color than I'm used to. Most of the technic parts are available in one color anyway. Any I don't want to browse "gear" category filled with obsolete or weird parts that i do not use at all. Like this:

https://drive.google.com/file/d/19bF0UTdJtpfH1-VBB1hgZSyByUndVhEM/view?usp=sharing

Thank you

Share this post


Link to post
Share on other sites

1) I'm not sure what you mean with this

2) I tried to organize the bin in such a matter content will automatically grow with new LDraw part releases.

But you are free to re-organize / extend them for use with static (colored) part lists by editing files located in %appdata%\LDCad\partBin.

See also http://www.melkert.net/LDCad/tech/partBin

 

Share this post


Link to post
Share on other sites
12 hours ago, roland said:

1) I'm not sure what you mean with this

2) I tried to organize the bin in such a matter content will automatically grow with new LDraw part releases.

But you are free to re-organize / extend them for use with static (colored) part lists by editing files located in %appdata%\LDCad\partBin.

See also http://www.melkert.net/LDCad/tech/partBin

 

Thank you for the reply, I have figured out the custom bins, I should have expected this, it is quite obvious:thumbup:

Regarding the 1) - the middle mouse button (when I click with the wheel) brings up properties window. I would like to remap it to camera movement left-right/up-down (currently shift+right mouse button).

Share this post


Link to post
Share on other sites
On 2/22/2019 at 9:59 AM, Ivan_M said:

Regarding the 1) - the middle mouse button (when I click with the wheel) brings up properties window. I would like to remap it to camera movement left-right/up-down (currently shift+right mouse button).

I might make that an option in 1.6c if I can implement it without too much of a hassle.

Share this post


Link to post
Share on other sites
On 2/23/2019 at 7:47 PM, roland said:

I might make that an option in 1.6c if I can implement it without too much of a hassle.

Cool, thank you.

One more thing that would make my life easier - would it be possible to add custom commands similar to other non-visual LDraw commands? I'm particullarly looking for LPub commands 0 !LPUB PLI BEGIN IGN and 0 !LPUB PLI END. When I use a lot of buffer exchange it would be easier to add this command directly in LDcad rather then in LPub, bacause it would be possible to move it much easier. Now I use !LICENCE and !KEYWORD to mark the PLI IGN start and end, then I open the mpd file in notepad replacing all instances with correct text. Thanks

Share this post


Link to post
Share on other sites
10 hours ago, Ivan_M said:

One more thing that would make my life easier - would it be possible to add custom commands similar to other non-visual LDraw commands? I'm particullarly looking for LPub commands 0 !LPUB PLI BEGIN IGN and 0 !LPUB PLI END.

You can do that using macros or by simply paste it from elsewhere (e.g. notepad).

For macros you'll need to learn lua scripting though. Examples are in the

%appdata%\ldcad\scripts\default\global

folder.

Share this post


Link to post
Share on other sites
4 hours ago, roland said:

You can do that using macros

Thought a specific sample would be helpful as it isn't that complicated but documentation is (very) lacking at the moment.

Create (while ldcad is closed) e.g. lpub.lua in

%appdata%\ldcad\scripts\default\global

With the below content.

When you start LDCad a new item will be added in the scripts menu, which leads to a submenu containing 'LPub snippet' when you click that it will add the three test lines to the current building step.

function addLine(ses, text) 

  local sf=ldc.subfile()
  local lineOfs, lineCnt=sf:getStepLineInfo(ses:getCurStepNr())
  local lineOfs=lineOfs+lineCnt

  local line, cnt=sf:addNewLine(lineOfs, text)
  ses:getSelection():add(line)
end

function lpubSnip_1() 

  local ses=ldc.session()
  if ses:isLinked() then
   
    ses:getSelection():remove()

    addLine(ses, '0 !LPUB some cool command')
    addLine(ses, '0 !LPUB another cool command')
    addLine(ses, '0 !LPUB etc')
  end
end

function register()

  local macro=ldc.macro('LPub snippet')
  --macro:setHint('')
  macro:setEvent('run', 'lpubSnip_1')
end
 
register()

 

Edited by roland

Share this post


Link to post
Share on other sites
12 hours ago, Ivan_M said:

Thank you, it is working fine

Also it's best to use this in combination with the source editor window inside LDCad so you can e.g. move content around for things like substitution. Or write a more complicated script that auto substitutes the selection or something like that :)

Share this post


Link to post
Share on other sites

I have a script for a few LPub commands:

function addLine(ses, text)
  local sf=ldc.subfile()
  local lineOfs, lineCnt=sf:getStepLineInfo(ses:getCurStepNr())
  local lineOfs=lineOfs+lineCnt
  local line, cnt=sf:addNewLine(lineOfs, text)
  ses:getSelection():add(line)
end

function LPubCallout()
  local ses=ldc.session()
  if ses:isLinked() then
    ses:getSelection():remove()
    addLine(ses, '0 !LPUB CALLOUT BEGIN')
    addLine(ses, '0 !LPUB CALLOUT END')
  end
end

function LPubPLI_Ign()
  local ses=ldc.session()
  if ses:isLinked() then
    ses:getSelection():remove()
    addLine(ses, '0 !LPUB PLI BEGIN IGN')
    addLine(ses, '0 !LPUB PLI END')
  end
end

function LPubPartIgn()
  local ses=ldc.session()
  if ses:isLinked() then
    ses:getSelection():remove()
    addLine(ses, '0 !LPUB PART BEGIN IGN')
    addLine(ses, '0 !LPUB PART END')
  end
end

function LPubPLI_PartSub()
  local ses=ldc.session()
  if ses:isLinked() then
    ses:getSelection():remove()
    addLine(ses, '0 !LPUB PLI BEGIN SUB filename.ldr 16')
    addLine(ses, '0 !LPUB PART BEGIN IGN')
    addLine(ses, '0 Line for Submodel to be replaced by filename.ldr')
    addLine(ses, '0 !LPUB PLI END')
    addLine(ses, '0 !LPUB PART END')
  end
end

function register()

  local macro=ldc.macro('LPub Callout')
  --macro:setHint('Add LPub Callout metacommands')
  macro:setEvent('run', 'LPubCallout')

  local macro=ldc.macro('LPub PLI ignore')
  --macro:setHint('Add LPub PLI ignore metacommands')
  macro:setEvent('run', 'LPubPLI_Ign')

  local macro=ldc.macro('LPub PART ignore')
  --macro:setHint('Add LPub PART ignore metacommands')
  macro:setEvent('run', 'LPubPartIgn')

  local macro=ldc.macro('LPub PLI and PART substitution')
  --macro:setHint('Add LPub PLI and PART substitution metacommands')
  macro:setEvent('run', 'LPubPLI_PartSub')


 end

register()

 

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.