Skip to content

Commit 795ee03

Browse files
committed
fix issue get data categories object size smaller than. 100
1 parent 5511a12 commit 795ee03

File tree

7 files changed

+322
-22
lines changed

7 files changed

+322
-22
lines changed

docs/example.ipynb

Lines changed: 301 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,17 @@
3131
},
3232
{
3333
"cell_type": "code",
34-
"execution_count": 6,
34+
"execution_count": 3,
35+
"metadata": {},
36+
"outputs": [],
37+
"source": [
38+
"# use incase of token expiry\n",
39+
"token.refresh()"
40+
]
41+
},
42+
{
43+
"cell_type": "code",
44+
"execution_count": 4,
3545
"metadata": {},
3646
"outputs": [
3747
{
@@ -257,7 +267,7 @@
257267
"[5 rows x 389 columns]"
258268
]
259269
},
260-
"execution_count": 6,
270+
"execution_count": 4,
261271
"metadata": {},
262272
"output_type": "execute_result"
263273
}
@@ -271,7 +281,7 @@
271281
},
272282
{
273283
"cell_type": "code",
274-
"execution_count": 7,
284+
"execution_count": 13,
275285
"metadata": {},
276286
"outputs": [
277287
{
@@ -511,7 +521,7 @@
511521
"[5 rows x 393 columns]"
512522
]
513523
},
514-
"execution_count": 7,
524+
"execution_count": 13,
515525
"metadata": {},
516526
"output_type": "execute_result"
517527
}
@@ -523,7 +533,7 @@
523533
},
524534
{
525535
"cell_type": "code",
526-
"execution_count": 8,
536+
"execution_count": 5,
527537
"metadata": {},
528538
"outputs": [
529539
{
@@ -541,10 +551,293 @@
541551
},
542552
{
543553
"cell_type": "code",
544-
"execution_count": null,
554+
"execution_count": 6,
545555
"metadata": {},
546-
"outputs": [],
547-
"source": []
556+
"outputs": [
557+
{
558+
"data": {
559+
"text/html": [
560+
"<div>\n",
561+
"<style scoped>\n",
562+
" .dataframe tbody tr th:only-of-type {\n",
563+
" vertical-align: middle;\n",
564+
" }\n",
565+
"\n",
566+
" .dataframe tbody tr th {\n",
567+
" vertical-align: top;\n",
568+
" }\n",
569+
"\n",
570+
" .dataframe thead th {\n",
571+
" text-align: right;\n",
572+
" }\n",
573+
"</style>\n",
574+
"<table border=\"1\" class=\"dataframe\">\n",
575+
" <thead>\n",
576+
" <tr style=\"text-align: right;\">\n",
577+
" <th></th>\n",
578+
" <th>objectid</th>\n",
579+
" <th>name</th>\n",
580+
" <th>ElementId</th>\n",
581+
" <th>externalId</th>\n",
582+
" <th>Family Name</th>\n",
583+
" <th>Category</th>\n",
584+
" <th>Structural</th>\n",
585+
" <th>Structural Usage</th>\n",
586+
" <th>Location Line</th>\n",
587+
" <th>Base Constraint</th>\n",
588+
" <th>...</th>\n",
589+
" <th>OmniClass Title</th>\n",
590+
" <th>Code Name</th>\n",
591+
" <th>Operation</th>\n",
592+
" <th>Frame Material</th>\n",
593+
" <th>Finish</th>\n",
594+
" <th>Door Material</th>\n",
595+
" <th>Define Thermal Properties by</th>\n",
596+
" <th>Visual Light Transmittance</th>\n",
597+
" <th>Solar Heat Gain Coefficient</th>\n",
598+
" <th>Analytic Construction</th>\n",
599+
" </tr>\n",
600+
" </thead>\n",
601+
" <tbody>\n",
602+
" <tr>\n",
603+
" <th>0</th>\n",
604+
" <td>99</td>\n",
605+
" <td>Basic Wall [291086]</td>\n",
606+
" <td>291086</td>\n",
607+
" <td>5bb069ca-e4fe-4e63-be31-f8ac44e80d30-0004710e</td>\n",
608+
" <td>Basic Wall</td>\n",
609+
" <td>Walls</td>\n",
610+
" <td>No</td>\n",
611+
" <td>Non-bearing</td>\n",
612+
" <td>Core Centerline</td>\n",
613+
" <td>Level 1</td>\n",
614+
" <td>...</td>\n",
615+
" <td>NaN</td>\n",
616+
" <td>NaN</td>\n",
617+
" <td>NaN</td>\n",
618+
" <td>NaN</td>\n",
619+
" <td>NaN</td>\n",
620+
" <td>NaN</td>\n",
621+
" <td>NaN</td>\n",
622+
" <td>NaN</td>\n",
623+
" <td>NaN</td>\n",
624+
" <td>NaN</td>\n",
625+
" </tr>\n",
626+
" <tr>\n",
627+
" <th>1</th>\n",
628+
" <td>100</td>\n",
629+
" <td>Basic Wall [291127]</td>\n",
630+
" <td>291127</td>\n",
631+
" <td>5bb069ca-e4fe-4e63-be31-f8ac44e80d30-00047137</td>\n",
632+
" <td>Basic Wall</td>\n",
633+
" <td>Walls</td>\n",
634+
" <td>No</td>\n",
635+
" <td>Non-bearing</td>\n",
636+
" <td>Core Centerline</td>\n",
637+
" <td>Level 1</td>\n",
638+
" <td>...</td>\n",
639+
" <td>NaN</td>\n",
640+
" <td>NaN</td>\n",
641+
" <td>NaN</td>\n",
642+
" <td>NaN</td>\n",
643+
" <td>NaN</td>\n",
644+
" <td>NaN</td>\n",
645+
" <td>NaN</td>\n",
646+
" <td>NaN</td>\n",
647+
" <td>NaN</td>\n",
648+
" <td>NaN</td>\n",
649+
" </tr>\n",
650+
" <tr>\n",
651+
" <th>2</th>\n",
652+
" <td>101</td>\n",
653+
" <td>Basic Wall [291148]</td>\n",
654+
" <td>291148</td>\n",
655+
" <td>5bb069ca-e4fe-4e63-be31-f8ac44e80d30-0004714c</td>\n",
656+
" <td>Basic Wall</td>\n",
657+
" <td>Walls</td>\n",
658+
" <td>No</td>\n",
659+
" <td>Non-bearing</td>\n",
660+
" <td>Core Centerline</td>\n",
661+
" <td>Level 1</td>\n",
662+
" <td>...</td>\n",
663+
" <td>NaN</td>\n",
664+
" <td>NaN</td>\n",
665+
" <td>NaN</td>\n",
666+
" <td>NaN</td>\n",
667+
" <td>NaN</td>\n",
668+
" <td>NaN</td>\n",
669+
" <td>NaN</td>\n",
670+
" <td>NaN</td>\n",
671+
" <td>NaN</td>\n",
672+
" <td>NaN</td>\n",
673+
" </tr>\n",
674+
" <tr>\n",
675+
" <th>3</th>\n",
676+
" <td>102</td>\n",
677+
" <td>Basic Wall [291214]</td>\n",
678+
" <td>291214</td>\n",
679+
" <td>5bb069ca-e4fe-4e63-be31-f8ac44e80d30-0004718e</td>\n",
680+
" <td>Basic Wall</td>\n",
681+
" <td>Walls</td>\n",
682+
" <td>No</td>\n",
683+
" <td>Non-bearing</td>\n",
684+
" <td>Core Centerline</td>\n",
685+
" <td>Level 1</td>\n",
686+
" <td>...</td>\n",
687+
" <td>NaN</td>\n",
688+
" <td>NaN</td>\n",
689+
" <td>NaN</td>\n",
690+
" <td>NaN</td>\n",
691+
" <td>NaN</td>\n",
692+
" <td>NaN</td>\n",
693+
" <td>NaN</td>\n",
694+
" <td>NaN</td>\n",
695+
" <td>NaN</td>\n",
696+
" <td>NaN</td>\n",
697+
" </tr>\n",
698+
" <tr>\n",
699+
" <th>4</th>\n",
700+
" <td>103</td>\n",
701+
" <td>Basic Wall [291254]</td>\n",
702+
" <td>291254</td>\n",
703+
" <td>5bb069ca-e4fe-4e63-be31-f8ac44e80d30-000471b6</td>\n",
704+
" <td>Basic Wall</td>\n",
705+
" <td>Walls</td>\n",
706+
" <td>No</td>\n",
707+
" <td>Non-bearing</td>\n",
708+
" <td>Core Centerline</td>\n",
709+
" <td>Level 1</td>\n",
710+
" <td>...</td>\n",
711+
" <td>NaN</td>\n",
712+
" <td>NaN</td>\n",
713+
" <td>NaN</td>\n",
714+
" <td>NaN</td>\n",
715+
" <td>NaN</td>\n",
716+
" <td>NaN</td>\n",
717+
" <td>NaN</td>\n",
718+
" <td>NaN</td>\n",
719+
" <td>NaN</td>\n",
720+
" <td>NaN</td>\n",
721+
" </tr>\n",
722+
" <tr>\n",
723+
" <th>5</th>\n",
724+
" <td>104</td>\n",
725+
" <td>Basic Wall [291292]</td>\n",
726+
" <td>291292</td>\n",
727+
" <td>5bb069ca-e4fe-4e63-be31-f8ac44e80d30-000471dc</td>\n",
728+
" <td>Basic Wall</td>\n",
729+
" <td>Walls</td>\n",
730+
" <td>No</td>\n",
731+
" <td>Non-bearing</td>\n",
732+
" <td>Core Centerline</td>\n",
733+
" <td>Level 1</td>\n",
734+
" <td>...</td>\n",
735+
" <td>NaN</td>\n",
736+
" <td>NaN</td>\n",
737+
" <td>NaN</td>\n",
738+
" <td>NaN</td>\n",
739+
" <td>NaN</td>\n",
740+
" <td>NaN</td>\n",
741+
" <td>NaN</td>\n",
742+
" <td>NaN</td>\n",
743+
" <td>NaN</td>\n",
744+
" <td>NaN</td>\n",
745+
" </tr>\n",
746+
" <tr>\n",
747+
" <th>6</th>\n",
748+
" <td>105</td>\n",
749+
" <td>Single-Flush [291310]</td>\n",
750+
" <td>291310</td>\n",
751+
" <td>5bb069ca-e4fe-4e63-be31-f8ac44e80d30-000471ee</td>\n",
752+
" <td>Single-Flush</td>\n",
753+
" <td>Doors</td>\n",
754+
" <td>NaN</td>\n",
755+
" <td>NaN</td>\n",
756+
" <td>NaN</td>\n",
757+
" <td>NaN</td>\n",
758+
" <td>...</td>\n",
759+
" <td>Doors</td>\n",
760+
" <td></td>\n",
761+
" <td></td>\n",
762+
" <td></td>\n",
763+
" <td></td>\n",
764+
" <td>Door - Panel</td>\n",
765+
" <td>Schematic Type</td>\n",
766+
" <td>0.000</td>\n",
767+
" <td>0.000</td>\n",
768+
" <td>Metal</td>\n",
769+
" </tr>\n",
770+
" </tbody>\n",
771+
"</table>\n",
772+
"<p>7 rows × 90 columns</p>\n",
773+
"</div>"
774+
],
775+
"text/plain": [
776+
" objectid name ElementId \\\n",
777+
"0 99 Basic Wall [291086] 291086 \n",
778+
"1 100 Basic Wall [291127] 291127 \n",
779+
"2 101 Basic Wall [291148] 291148 \n",
780+
"3 102 Basic Wall [291214] 291214 \n",
781+
"4 103 Basic Wall [291254] 291254 \n",
782+
"5 104 Basic Wall [291292] 291292 \n",
783+
"6 105 Single-Flush [291310] 291310 \n",
784+
"\n",
785+
" externalId Family Name Category \\\n",
786+
"0 5bb069ca-e4fe-4e63-be31-f8ac44e80d30-0004710e Basic Wall Walls \n",
787+
"1 5bb069ca-e4fe-4e63-be31-f8ac44e80d30-00047137 Basic Wall Walls \n",
788+
"2 5bb069ca-e4fe-4e63-be31-f8ac44e80d30-0004714c Basic Wall Walls \n",
789+
"3 5bb069ca-e4fe-4e63-be31-f8ac44e80d30-0004718e Basic Wall Walls \n",
790+
"4 5bb069ca-e4fe-4e63-be31-f8ac44e80d30-000471b6 Basic Wall Walls \n",
791+
"5 5bb069ca-e4fe-4e63-be31-f8ac44e80d30-000471dc Basic Wall Walls \n",
792+
"6 5bb069ca-e4fe-4e63-be31-f8ac44e80d30-000471ee Single-Flush Doors \n",
793+
"\n",
794+
" Structural Structural Usage Location Line Base Constraint ... \\\n",
795+
"0 No Non-bearing Core Centerline Level 1 ... \n",
796+
"1 No Non-bearing Core Centerline Level 1 ... \n",
797+
"2 No Non-bearing Core Centerline Level 1 ... \n",
798+
"3 No Non-bearing Core Centerline Level 1 ... \n",
799+
"4 No Non-bearing Core Centerline Level 1 ... \n",
800+
"5 No Non-bearing Core Centerline Level 1 ... \n",
801+
"6 NaN NaN NaN NaN ... \n",
802+
"\n",
803+
" OmniClass Title Code Name Operation Frame Material Finish Door Material \\\n",
804+
"0 NaN NaN NaN NaN NaN NaN \n",
805+
"1 NaN NaN NaN NaN NaN NaN \n",
806+
"2 NaN NaN NaN NaN NaN NaN \n",
807+
"3 NaN NaN NaN NaN NaN NaN \n",
808+
"4 NaN NaN NaN NaN NaN NaN \n",
809+
"5 NaN NaN NaN NaN NaN NaN \n",
810+
"6 Doors Door - Panel \n",
811+
"\n",
812+
" Define Thermal Properties by Visual Light Transmittance \\\n",
813+
"0 NaN NaN \n",
814+
"1 NaN NaN \n",
815+
"2 NaN NaN \n",
816+
"3 NaN NaN \n",
817+
"4 NaN NaN \n",
818+
"5 NaN NaN \n",
819+
"6 Schematic Type 0.000 \n",
820+
"\n",
821+
" Solar Heat Gain Coefficient Analytic Construction \n",
822+
"0 NaN NaN \n",
823+
"1 NaN NaN \n",
824+
"2 NaN NaN \n",
825+
"3 NaN NaN \n",
826+
"4 NaN NaN \n",
827+
"5 NaN NaN \n",
828+
"6 0.000 Metal \n",
829+
"\n",
830+
"[7 rows x 90 columns]"
831+
]
832+
},
833+
"execution_count": 6,
834+
"metadata": {},
835+
"output_type": "execute_result"
836+
}
837+
],
838+
"source": [
839+
"revit_data.get_data_by_categories([\"Walls\",\"Doors\"])"
840+
]
548841
}
549842
],
550843
"metadata": {

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name="revit_meows",
5-
version="0.1.2",
5+
version="0.1.3",
66
author="chuongmep",
77
author_email="[email protected]",
88
description="A tool for extracting data from Revit ACC",

src/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from revit_meows import APSRevit
1+
from .revit_meows import APSRevit

src/revit_meows.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,15 @@ def get_data_by_categories(self, categories: list[str], model_guid=None, is_fiel
325325
object_ids = df_tree_filter['objectid'].tolist()
326326
if not object_ids or len(object_ids) == 0:
327327
return pd.DataFrame()
328-
# if object_ids > 1000, split to 1000 object ids
328+
329329
if len(object_ids) > 1000:
330-
object_ids = [object_ids[i:i + 1000] for i in range(0, len(object_ids), 1000)]
330+
# chuck to list in list
331+
object_ids_arrays = [object_ids[i:i + 1000] for i in range(0, len(object_ids), 1000)]
332+
else:
333+
object_ids_arrays = [object_ids]
331334
df = pd.DataFrame()
332-
for obj_ids in object_ids:
333-
df_single = self.get_data_by_object_ids(model_guid, object_ids=obj_ids, is_field_param=is_field_param)
335+
for object_ids in object_ids_arrays:
336+
df_single = self.get_data_by_object_ids(model_guid, object_ids=object_ids, is_field_param=is_field_param)
334337
df = pd.concat([df, df_single], ignore_index=True)
335338
# drop column CatDbId
336339
df_tree = df_tree.drop(columns=['CatDbId'])

test/__init__.py

Whitespace-only changes.

test/context.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import sys
3-
src_dir = os.path.abspath(os.path.join(os.path.dirname(__file__)))
3+
src_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'src'))
44
print(src_dir)
5-
sys.path.insert(0, src_dir)
5+
sys.path.append(src_dir)
66

7-
from src.revit_meows import APSRevit
7+
from revit_meows import APSRevit

0 commit comments

Comments
 (0)