Autodesk设计自动化Revit,文本文件作为输入

时间:2020-04-23 19:30:43

标签: autodesk-forge autodesk-model-derivative autodesk-data-management autodesk-designautomation

我开发的Revit API,以文本文件作为输入。 文本文件如下所示……

1.002,20,502,21.706

12.502、5,502、7.706

21.002,15,502,14.706

.....................

...................... (值不正确。只是虚构。我只是在显示我的文本文件的样子)

我基本上是在读取文本数据作为输入。 现在,如果要转换与设计自动化API相同的API,我想我将无法使用“文本文件”作为输入。

我的问题是,如果输入文件由如上所述的3d点坐标组成,应该是什么类型的输入文件。 应该是杰森吗?如果它需要是json,那么我应该如何为点坐标编写它?或任何其他有关文件类型的建议都会有很大帮助。

如果有任何示例代码,将有很大帮助。

在支持的输入文件格式列表中,不包括txt文件。

如果我写了一个Json文件,请给我一些提示,我该如何安排它并阅读Revit的文件。

非常感谢。

T

1 个答案:

答案 0 :(得分:0)

感谢您的查询。

稍微复杂一点的问题是如何生成多个输出文件。

文章已回答 在How to generate dynamic number of output with Design Automation for Revit V3上。

顺便说一句,它还提到了多个输入文件,说:

“ ...对于压缩的输入文件,其详细记录在https://forge.autodesk.com/en/docs/design-automation/v3/tutorials/revit/step6-post-workitem/中,但是对于输出的压缩结果,它并不清楚...”

尝试跟踪该链接,我注意到它已过期。

更新的链接为:

https://forge.autodesk.com/en/docs/design-automation/v3/tutorials/revit/step7-post-workitem/

看看additional notes on input arguments,我看到了有关如何在工作项本身中直接传递JSON输入数据的说明。

我认为您也可以使用其他前缀代替library(dplyr) library(tidyr) df %>% pivot_longer(cols = -c(id, type), names_to = c('.value', 'year'), names_sep= "(?<=[a-z])(?=[0-9])") # A tibble: 18 x 5 # type id year age bool # <int> <int> <chr> <int> <int> # 1 1 1 2000 20 1 # 2 1 1 2001 21 1 # 3 1 1 2002 22 1 # 4 1 2 2000 35 2 # 5 1 2 2001 36 2 # 6 1 2 2002 37 2 # 7 1 3 2000 24 1 # 8 1 3 2001 25 1 # 9 1 3 2002 26 1 #10 2 1 2000 32 2 #11 2 1 2001 33 2 #12 2 1 2002 34 2 #13 2 2 2000 66 2 #14 2 2 2001 67 2 #15 2 2 2002 68 2 #16 2 3 2000 14 1 #17 2 3 2001 15 1 #18 2 3 2002 16 1 之类的df <- structure(list(type = c(1L, 1L, 1L, 2L, 2L, 2L), id = c(1L, 2L, 3L, 1L, 2L, 3L), age2000 = c(20L, 35L, 24L, 32L, 66L, 14L), age2001 = c(21L, 36L, 25L, 33L, 67L, 15L), age2002 = c(22L, 37L, 26L, 34L, 68L, 16L), bool2000 = c(1L, 2L, 1L, 2L, 2L, 1L), bool2001 = c(1L, 2L, 1L, 2L, 2L, 1L), bool2002 = c(1L, 2L, 1L, 2L, 2L, 1L)), class = "data.frame", row.names = c(NA, -6L)) 来以当前形式传递数据。

请尝试一下,让我们知道它如何为您工作。

或者,您可以保持安全,将文本数据转换为JSON格式。

有无数种方法。

最简单,最简单的方法如下:

data:application/json

代表双打数组。

一种稍微结构化的方法可能是像这样传递一组三重双打:

data:application/text

如您所见,这并不难。

我希望这会有所帮助。