Yes. I wrote a sample java class with the BpmnModel, and tried adding a Pool and then also a lane. But it just fails at the last line of the following code with a message error creating XML.
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
BpmnModel model = new BpmnModel();
Process process = new Process();
model.addProcess(process);
process.setId(processName);
// Progammatically creating lanes seems an issue , commented to make the code compile and run
//Lane tempLane = new Lane();
//Pool tempPool = new Pool();
//tempLane.setParentProcess(process);
//process.getLanes().add(tempLane);
process.addFlowElement(createStartEvent();
process.addFlowElement(createUserTask();
process.addFlowElement(createEndEvent());
RepositoryService repositoryService = processEngine.getRepositoryService();
RuntimeService runtimeService = processEngine.getRuntimeService();
Deployment deployment = repositoryService.createDeployment().addBpmnModel(bpmnModelName, model).name(description).deploy();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processName);
//Fails on the below line with a message error creating XML
InputStream processDiagram = processEngine.getRepositoryService().getProcessDiagram(processInstance.getProcessDefinitionId());
FileUtils.copyInputStreamToFile(processDiagram, new File(diagramFileName));