Specs Editor missing Python based components

Specs Editor missing Python based components

theshoaib.mughal
Advocate Advocate
456 Views
5 Replies
Message 1 of 6

Specs Editor missing Python based components

theshoaib.mughal
Advocate
Advocate

Hello guys. 

thanks for all the previous help you have provided me.

Today I faced a new issue regarding Specs Editor. I cannot find the custom components in the 'Add new Component' section. I have checked and rechecked all the setting. All pyhthon script loaded into ContentFolder\CPak Common\CustomScripts and I have also verfied the content folder path in specs editor. Its pointing to the same directory. Untill this morning everything was working finenand all my components were showing and being used the 3D model effectively. The only change in the last couple hours is that I have created a new component and now nothing is shown in the 'Add New components' and only the default parts that comes with Autocad.

 

I am totally dumbstruck here because if it was a problem with content folder location and its vector, none of my 3D components should have been shown in the 3D model. Instead I should have get the message "can't find the symbol for specified part" but thats not happening. Components are working fine in everyway but can't add new because I can't find any even those already in the specs. It doesn't look like relating to script as well because before the latest script all were showing in the specs editor so why not now (still I tried removing the latest script and also tried emptying the scripts folder and compiled freshly to generate new ScriptGroup and Varients XMLs). The component being created by this latest script also doesn't have any coding problem because TESTACPSCRIPT is succesfully loading it. 

 

So I am now literally dumbstruck on what to do next. The onky thing I haven't tried is reinstalling the AutoCAD P3D from scratch and I'd rather avoid it if I can. Any help guys??

0 Likes
Accepted solutions (1)
457 Views
5 Replies
Replies (5)
Message 2 of 6

h_eger
Mentor
Mentor

Dear @theshoaib.mughal ,

 

which Plant 3D version?
Older than P3D 2021 or newer than 2022?

https://asti.com/blog/migrating-shared-content-to-plant-3d-2022/

-

If my reply was helpful, please give a "Kudo" or click the "Accept as Solution" button below (or both).

Hartmut Eger
Senior Engineer
Anlagenplanung + Elektotechnik
XING | LinkedIn

EESignature



Message 3 of 6

theshoaib.mughal
Advocate
Advocate

Sorry forgot to mention, Its Plant 3D 2023 (cuz 2024 is crashing too much on my PC). And I have also tried migrating the content folder to another folder/drive. Nothing seems to work. There is something else wrong because if the content folder wasn't linked then none of my components would have shown their display images in Spec Editor and neither in the Plant 3D model. But everything seems working fine except that I cannot see the custom script based component anymore in my 'Add new Component' dialog in Specs Editor

0 Likes
Message 4 of 6

theshoaib.mughal
Advocate
Advocate
Accepted solution

Its okay. I figured out the reason. Its all solved now. Turned out an error in the code. In the long description of the part i have used '< >' symbols. So when compiling its no issue, when testing with acpscript its no issu but the specs editor looks into varient.xml and there it was an issue. Since these marks are body syntax of xml code and xml translate the python code exactly, so these marks disrupted the xml body and made it unreadable to compiler and so every component was missing from specs editor. 

 

The problem resolved when i removed these marks from the code

Message 5 of 6

stephanYN6LU
Participant
Participant

I have the exact same issue, was working on 2023, and yesterday start working on 2024. The components that were working does not show anymore. I did however spotted a folder named '__pycache__' with the <file>.pyc in it. So I deleted everything generated that will be all the old <file>.pyc  and <file>.xml with ScriptGroup.xml, variants.map and variants.xml. Did again the PLANTREGISTERCUSTOMSCRIPTS, closed down Autocad, re-opened, did the TESTACPSCRIPT command, everything generated in autocad, but still no luck with adding Python based components. See reference to what I have posted.

 

Reference:

https://forums.autodesk.com/t5/autocad-plant-3d-forum/help-needed-creating-new-components-custom-com...

0 Likes
Message 6 of 6

theshoaib.mughal
Advocate
Advocate

Hello Stephan,

 

I have looked at the PDF file you have uploaded. Everything seems fine except for one thing. Your python files (.py, .pyc, .xml, .png) are stored ina sub folder under custom CustomScript folder. This is okay when you test the components using TESTACPSCRIPT command because it goes deeper inside the content folder. But it's quite different with specs editor. It target only CustomScript folder to look for pyc and png files. (with autocad version 22 and later it includes _pychache in it's search index as well because that's where the pyc files are located after compile). Now there are two solutions that I recommend.

 

First is to move all your PY and PNG files into root of CustomScript folder and recompile them (PLANTREGISTERCUSTOMSCRIPT) then your specs editor will  be able to locate them and you can see them (run specs editor with admin rights).

 

Second solution is not yet tested but in theory it should work. If you are making a sub folder for your scripts then add _ (underscore) before it's name. In windows environment this underscore represents a connection with parent directory so any search of the parent directory automatically includes it. So technically, specs editor should find it as well. Try that and if that does not work then you can do with first method

0 Likes