AutoCAD Plant 3D Forum
Welcome to Autodesk’s AutoCAD Plant 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Plant 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

When object has been insterted,next time script works incorrectly

3 REPLIES 3
Reply
Message 1 of 4
kudryavcevrm
600 Views, 3 Replies

When object has been insterted,next time script works incorrectly

Please, help me!

There's a simple script:

import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'CustomScripts'))



from aqa.math import *
from varmain.primitiv import *
from varmain.custom import *


@activate(Group="Support", TooltipShort="Test script", TooltipLong="This is a custom Testscript", LengthUnit="in")
@group("MainDimensions")
@param(aL=LENGTH, TooltipLong="Length of the Cylinder")


def TEST1(s, aL=75.0, ID='P_ACTUATOR_008', **kw):

       aL=float(raw_input("Input text"))
       print "You have been enter:"
       print (aL)

 Look here:

  1. Plant 3D Russian 2013 (Ultimate Suite) SP1, Windows 7 Ultimate
  2. I compile my script using PLANTREGISTERCUSTOMSCRIPT command and restart Plant 3D after this
  3. (arxload "PnP3dACPAdapter.arx")
  4. (TESTACPSCRIPT "TEST1")

Please see my command line log :

Команда: (arxload "PnP3dACPAdapter.arx")
"PnP3dACPAdapter.arx"

Команда: (TESTACPSCRIPT "TEST1")
Input text78
You have been enter:
78.0
<Имя объекта: 7ffff705c00>

Команда: (TESTACPSCRIPT "TEST1")
<Имя объекта: 7ffff705c20>

 

As you can see, my friends, when script was executed in the next time in the same session, it keeps aL value.

 

When we now execute _PURGE command, script will be executed correctly.

 

How to modify my script???

3 REPLIES 3
Message 2 of 4
kudryavcevrm
in reply to: kudryavcevrm

up

Message 3 of 4

The scripts are meant to create geometry (i.e. a block). To avoid regenerating the same block all the time, Plant 3D first looks up the block table if it already has a block that matches the script parameters. If such a block exists, it will just use it, and not invoke the script.

 

It looks like in this case, each block shall be unique. I haven’t tried it, but (TESTACPSCRIPT "…" "__unique__" "1") will probably do what is wanted. It will create an anonymous block instead of a block that hashes the parameters.



Marat Mirgaleev
Developer Technical Services
Autodesk Developer Network
Message 4 of 4

Thank you, Marat.
"__unique__" works fine in test mode. But we need to use script in real life, not in test mode only. We need to compile script as unique.
Help me, please!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost