Recommended Posts

Just now, 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?

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

Share this post


Link to post
Share on other sites
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

You can open the .lxf file in stud.io and export it to Ldraw. It does a better conversion than LDD.

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
Posted (edited)
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
Posted (edited)

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
Posted (edited)

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

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.