Jump to content
UltiMaker Community of 3D Printing Experts

Ultibaker script


greengecko

Recommended Posts

Posted · Ultibaker script

Hi,

I suggested this a while ago to Daid (but he did not respond, so he was either busy or did not think it was a good idea).

I had the idea especially because SteamEngine is so fast, that it would be great to have the ability to have different profiles during prints (at least switch the profile between layers). My idea was to define via a table of the following style:

file to.mm profile cubetest

ubakecsv

(= a csv file (e.g. created in Excel, germans be aware csv means comma seperated not ;" which is used in the german excel version and would not work)

The table defines which profile should be used at which model height (in mm).

As I did not write my own slicer (which is not an easy task I guess :wink: ) I took advantage of the steam engine speed. I sliced my models using different settings and saved them as different gcode files (e.g. cubetest1, cubetest2, cubetest3 for three different profiles using different infill settings, layer height etc.,) The table above defines then at which height (in mm) of the model which profile should be used. Then I run my R script (I use R because I am most familiar with it) and let the script combine them into a single file. In principle you could do it by hand but it needs some calculation if you need different layer heights.

The script is only partly intelligent. It checks only if there is no available layer and then searches for a common layer height where it can swap the profile.

An example would be, you start with the first layer at 0.3 (default in Cura) and then 0.2 mm as the layer height, but would like to change to a layer height of 0.3 mm at 1mm. This is not possible, because if you add 0.3+0.2+0.2+0.2 then you end up at 0.9mm or 1.1mm but not 1.0 mm height. So the script searches for the common layer height in the profiles (in this case 0.9, because 0.3 + 0.3 + 0.3 = 0.9) and switch at 0.9 mm to your new profile.

Otherwise it is pretty stupid, so if you want to print with 100% infill over a 5% infill then you probably will have trouble. Also other inconsistencies may occur.

It is still in a testing phase, it ran fine with my tests. Be aware that rapidly changing the layer height is not a good idea because of under/overextrusion so change only via modest steps. You are allowed to use as many profiles in one models as you want, so define intermediate steps and do not change layer height from 0.1 to 0.3 in one layer.

If there is some interest I am happy to provide a more elaborated manual and upload it to youmagine. I kind of back-engeneered Daids gcode, so if he decides to change his comments in Cura the script will be lost.....

Instructions:

Below I copy/pasted the R script. So to run this you need

 

  • [*]R (
http://cran.r-project.org/).

[*]Save the script as e.g. ultibaker.R and

[*]create a csv using the format above (Make sure you use exactly the same headings otherwise I will not work)

[*]Create different profiles of your model and save them in the same folder. Name them with consecutive numbers and the filename your provide in the csv file, e.g. frog1.gcode, frog2.gcode, frog3.gcode etc. Start with 1.

[*]Run the script (copy/paste it into the R console), it asks first for the folder and then for the csv file.

[*]This will create a new file called "file_baked.gcode" in your folder.

[*]Print your model using this new file

 

Obviously observe the printing as I provide no guarantee that it works . USE IT AT YOUR OWN RISK!

Happy to get feedback and even more happy if this idea will be at some stage integrated into Cura if agreed to be useful.

Cheers,

greengecko

############################script starts here############

path <-choose.dir(default = "", caption = "Select folder")

setwd(path)

settings <- read.csv(file.choose())

fn <- settings$file[1]

def.heights <- settings$to.mm

qualities <- settings$profile

nof <-length(unique(settings$profile))

files <-list()

lay.height<-NA

lay.tot<-NA

####### load files and determine layerheight

for (i in 1:nof)

{

con<-file(paste(fn,i,".gcode",sep=""))

files[] <-readLines(con)

close(con)

index <-grep("Layer height:",files[])

layerstr <- files[][index]

lay.height<-as.numeric(strsplit((gsub(";Basic settings: Layer height: ", "", layerstr))," ")[[1]][1])

#find model height

index <-grep(";total_layers=",files[])

layerstr <- files[][index]

lay.tot <-as.numeric( gsub(";total_layers=","",layerstr) )

}

#####################################################################

#lay.height=lay.height*1000

#####################################################################

# put together at layer heights

i<-1

xx<-files[]

a<-regexpr(" Z",xx)

hhh <- xx[a>10 & a<30]

ind <-a[a>10 & a<30]

hh<- as.numeric(substr(hhh,ind+2,ind+6))

model.def <- data.frame(seq=hh, l1=1)

for (i in 2:nof)

{

xx<-files[]

a<-regexpr(" Z",xx)

hhh <- xx[a>10 & a<30]

ind <-a[a>10 & a<30]

hh<- as.numeric(substr(hhh,ind+2,ind+6))

dl <-data.frame(seq=hh, x=1)

colnames(dl)[2] <- paste("l",i,sep="")

model.def <- merge(model.def,dl ,by="seq", all=T)

}

############################################

#define your model

############################################

#cat("Define your model from: 0 to",max(model.def$seq), "mm\n")

for (i in 1:(length(qualities)-1)) cat("To",def.heights,"mm : Quality",qualities,"\n")

#add the last quality for the virtual last layer+1

qualities <-c(qualities,qualities[length(qualities)])

######## adjust if not possible and find layer

chunksto=NA

getlayto=NA

getlayfrom[1]=0

for (i in 1:(length(qualities)-1))

{

#if (i==1) from=1 else from=which(model.def$seq==def.heights)

to = which(model.def$seq==def.heights)

dummyto<-model.def[1:to,c(1+qualities,1+qualities[i+1])]

chunksto<- max(which(dummyto[,1] == dummyto[,2]))

getlayto <- sum(model.def[1:chunksto,1+qualities],na.rm=T)

getlayfrom[i+1] <- sum(model.def[1:chunksto,1+qualities[i+1]],na.rm=T)

}

i=1

outfile<-character()

#get start code from first file

indexto <-min(grep(paste(";LAYER:",getlayto, sep=""),files[[qualities]]))

outfile <- files[[qualities]][1:indexto-1]

for (i in 2:(length(qualities)-2))

{

indexfrom <-min(grep(paste(";LAYER:",getlayfrom, sep=""),files[[qualities]]))

files[[qualities]][indexfrom] <- paste(files[[qualities]][indexfrom] ," QUALITY:",qualities," LAYER HEIGHT:",lay.height[qualities], sep="")

indexto <-min(grep(paste(";LAYER:",getlayto, sep=""),files[[qualities]]))

outfile <- c(outfile,files[[qualities]][indexfrom:indexto-1])

}

i=length(qualities)-1

indexfrom <-min(grep(paste(";LAYER:",getlayfrom, sep=""),files[[qualities]]))

files[[qualities]][indexfrom] <- paste(files[[qualities]][indexfrom] ," QUALITY:",qualities," LAYER HEIGHT:",lay.height[qualities], sep="")

indexto <- length(files[[qualities]])-1

outfile <- c(outfile,files[[qualities]][indexfrom:indexto-1])

con<-file(paste(fn,"_baked",".gcode",sep=""), open="w")

writeLines(outfile,con)

close(con)

 

############################script finishes here############

 

  • Link to post
    Share on other sites

    Posted · Ultibaker script

    I suggested this a while ago to Daid (but he did not respond, so he was either busy or did not think it was a good idea).

    I had the idea especially because SteamEngine is so fast, that it would be great to have the ability to have different profiles during prints

     

    Just so you know, I do think it's a good idea, but it's a UI nightmare at the same time ;-) see NetFabb, I think it can do this.

     

  • 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
    • Our picks

      • UltiMaker Cura 5.3 stable released
        In this stable release, Cura 5.3 achieves yet another huge leap forward in 3D printing thanks to material interlocking! As well as introducing an expanded recommended print settings menu and lots of print quality improvements. Not to mention, a whole bunch of new printer profiles for non-UltiMaker printers!
          • Thanks
          • Like
        • 24 replies
      • Here it is. The new UltiMaker S7
        The UltiMaker S7 is built on the success of the UltiMaker S5 and its design decisions were heavily based on feedback from customers.
         
         
        So what’s new?
        The obvious change is the S7’s height. It now includes an integrated Air Manager. This filters the exhaust air of every print and also improves build temperature stability. To further enclose the build chamber the S7 only has one magnetically latched door.
         
        The build stack has also been completely redesigned. A PEI-coated flexible steel build plate makes a big difference to productivity. Not only do you not need tools to pop a printed part off. But we also don’t recommend using or adhesion structures for UltiMaker materials (except PC, because...it’s PC). Along with that, 4 pins and 25 magnets make it easy to replace the flex plate perfectly – even with one hand.
         
        The re-engineered print head has an inductive sensor which reduces noise when probing the build plate. This effectively makes it much harder to not achieve a perfect first layer, improving overall print success. We also reversed the front fan direction (fewer plastic hairs, less maintenance), made the print core door magnets stronger, and add a sensor that helps avoid flooding.
         

         
        The UltiMaker S7 also includes quality of life improvements:
        Reliable bed tilt compensation (no more thumbscrews) 2.4 and 5 GHz Wi-Fi A 1080p camera (mounted higher for a better view) Compatibility with 280+ Marketplace materials Compatibility with S5 project files (no reslicing needed) And a whole lot more  
        Curious to see the S7 in action?
        We’re hosting a free tech demo on February 7.
        It will be live and you can ask any questions to our CTO, Miguel Calvo.
        Register here for the Webinar
          • Like
        • 18 replies
      • UltiMaker Cura Alpha 🎄 Tree Support Spotlight 🎄
        Are you a fan of tree support, but dislike the removal process and the amount of filament it uses? Then we would like to invite you to try this special release of UltiMaker Cura. Brought to you by our special community contributor @thomasrahm
         
        We generated a special version of Cura 5.2 called 5.3.0 Alpha + Xmas. The only changes we introduced compared to UltiMaker Cura 5.2.1 are those which are needed for the new supports. So keep in mind, this is not a sneak peek for Cura 5.3 (there are some really cool new features coming up) but a spotlight release highlighting this new version of tree supports.  
          • Like
        • 22 replies
    ×
    ×
    • Create New...